File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,26 @@ feature! {
188188 & ' a E : io:: Write + ' a,
189189 {
190190 use std:: io:: Write ;
191- self . registration. poll_write_io( cx, || self . io. as_ref( ) . unwrap( ) . write( buf) )
191+
192+ loop {
193+ let evt = ready!( self . registration. poll_write_ready( cx) ) ?;
194+
195+ match self . io. as_ref( ) . unwrap( ) . write( buf) {
196+ Ok ( n) => {
197+ // if we write only part of our buffer, this is sufficient on unix to show
198+ // that the socket buffer is full
199+ if n > 0 && ( !cfg!( windows) && n < buf. len( ) ) {
200+ self . registration. clear_readiness( evt) ;
201+ }
202+
203+ return Poll :: Ready ( Ok ( n) ) ;
204+ } ,
205+ Err ( e) if e. kind( ) == io:: ErrorKind :: WouldBlock => {
206+ self . registration. clear_readiness( evt) ;
207+ }
208+ Err ( e) => return Poll :: Ready ( Err ( e) ) ,
209+ }
210+ }
192211 }
193212
194213 #[ cfg( feature = "net" ) ]
You can’t perform that action at this time.
0 commit comments