@@ -387,41 +387,6 @@ impl MessageReader {
387387 }
388388 }
389389
390- /// Called when we receive an IO Completion Packet for this handle.
391- fn notify_completion ( & mut self , err : u32 ) -> Result < ( ) , WinError > {
392- win32_trace ! ( "[$ {:?}] notify_completion" , self . handle) ;
393-
394- // mark a read as no longer in progress even before we check errors
395- self . read_in_progress = false ;
396-
397- if err == winapi:: ERROR_BROKEN_PIPE {
398- assert ! ( !self . closed, "we shouldn't get an async BROKEN_PIPE after we already got one" ) ;
399- self . closed = true ;
400- return Ok ( ( ) ) ;
401- }
402-
403- let nbytes = self . ov . InternalHigh as u32 ;
404- let offset = self . ov . Offset ;
405-
406- assert ! ( offset == 0 ) ;
407-
408- // if the remote end closed...
409- if err != winapi:: ERROR_SUCCESS {
410- // This should never happen
411- panic ! ( "[$ {:?}] *** notify_completion: unhandled error reported! {}" , self . handle, err) ;
412- }
413-
414- unsafe {
415- let new_size = self . read_buf . len ( ) + nbytes as usize ;
416- win32_trace ! ( "nbytes: {}, offset {}, buf len {}->{}, capacity {}" ,
417- nbytes, offset, self . read_buf. len( ) , new_size, self . read_buf. capacity( ) ) ;
418- assert ! ( new_size <= self . read_buf. capacity( ) ) ;
419- self . read_buf . set_len ( new_size) ;
420- }
421-
422- Ok ( ( ) )
423- }
424-
425390 // kick off an asynchronous read
426391 fn start_read ( & mut self ) -> Result < ( ) , WinError > {
427392 if self . read_in_progress || self . closed {
@@ -483,6 +448,41 @@ impl MessageReader {
483448 }
484449 }
485450
451+ /// Called when we receive an IO Completion Packet for this handle.
452+ fn notify_completion ( & mut self , err : u32 ) -> Result < ( ) , WinError > {
453+ win32_trace ! ( "[$ {:?}] notify_completion" , self . handle) ;
454+
455+ // mark a read as no longer in progress even before we check errors
456+ self . read_in_progress = false ;
457+
458+ if err == winapi:: ERROR_BROKEN_PIPE {
459+ assert ! ( !self . closed, "we shouldn't get an async BROKEN_PIPE after we already got one" ) ;
460+ self . closed = true ;
461+ return Ok ( ( ) ) ;
462+ }
463+
464+ let nbytes = self . ov . InternalHigh as u32 ;
465+ let offset = self . ov . Offset ;
466+
467+ assert ! ( offset == 0 ) ;
468+
469+ // if the remote end closed...
470+ if err != winapi:: ERROR_SUCCESS {
471+ // This should never happen
472+ panic ! ( "[$ {:?}] *** notify_completion: unhandled error reported! {}" , self . handle, err) ;
473+ }
474+
475+ unsafe {
476+ let new_size = self . read_buf . len ( ) + nbytes as usize ;
477+ win32_trace ! ( "nbytes: {}, offset {}, buf len {}->{}, capacity {}" ,
478+ nbytes, offset, self . read_buf. len( ) , new_size, self . read_buf. capacity( ) ) ;
479+ assert ! ( new_size <= self . read_buf. capacity( ) ) ;
480+ self . read_buf . set_len ( new_size) ;
481+ }
482+
483+ Ok ( ( ) )
484+ }
485+
486486 // This is split between get_message and get_message_inner, so that
487487 // this function can handle removing bytes from the buffer, since
488488 // get_message_inner borrows the buffer.
0 commit comments