Commit 3a6642e 1 parent 051cd41 commit 3a6642e Copy full SHA for 3a6642e
File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -838,14 +838,21 @@ mod verbose {
838
838
fn poll_read (
839
839
mut self : Pin < & mut Self > ,
840
840
cx : & mut Context ,
841
- buf : ReadBufCursor < ' _ > ,
841
+ mut buf : ReadBufCursor < ' _ > ,
842
842
) -> Poll < std:: io:: Result < ( ) > > {
843
- match Pin :: new ( & mut self . inner ) . poll_read ( cx, buf) {
843
+ // TODO: This _does_ forget the `init` len, so it could result in
844
+ // re-initializing twice. Needs upstream support, perhaps.
845
+ // SAFETY: Passing to a ReadBuf will never de-initialize any bytes.
846
+ let mut vbuf = hyper:: rt:: ReadBuf :: uninit ( unsafe { buf. as_mut ( ) } ) ;
847
+ match Pin :: new ( & mut self . inner ) . poll_read ( cx, vbuf. unfilled ( ) ) {
844
848
Poll :: Ready ( Ok ( ( ) ) ) => {
845
- /*
846
- log::trace!("{:08x} read: {:?}", self.id, Escape(buf.filled()));
847
- */
848
- log:: trace!( "TODO: verbose poll_read" ) ;
849
+ log:: trace!( "{:08x} read: {:?}" , self . id, Escape ( vbuf. filled( ) ) ) ;
850
+ let len = vbuf. filled ( ) . len ( ) ;
851
+ // SAFETY: The two cursors were for the same buffer. What was
852
+ // filled in one is safe in the other.
853
+ unsafe {
854
+ buf. advance ( len) ;
855
+ }
849
856
Poll :: Ready ( Ok ( ( ) ) )
850
857
}
851
858
Poll :: Ready ( Err ( e) ) => Poll :: Ready ( Err ( e) ) ,
You can’t perform that action at this time.
0 commit comments