Commit d99e90d 1 parent aba01ff commit d99e90d Copy full SHA for d99e90d
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 @@ -1140,14 +1140,21 @@ mod verbose {
1140
1140
fn poll_read (
1141
1141
mut self : Pin < & mut Self > ,
1142
1142
cx : & mut Context ,
1143
- buf : ReadBufCursor < ' _ > ,
1143
+ mut buf : ReadBufCursor < ' _ > ,
1144
1144
) -> Poll < std:: io:: Result < ( ) > > {
1145
- match Pin :: new ( & mut self . inner ) . poll_read ( cx, buf) {
1145
+ // TODO: This _does_ forget the `init` len, so it could result in
1146
+ // re-initializing twice. Needs upstream support, perhaps.
1147
+ // SAFETY: Passing to a ReadBuf will never de-initialize any bytes.
1148
+ let mut vbuf = hyper:: rt:: ReadBuf :: uninit ( unsafe { buf. as_mut ( ) } ) ;
1149
+ match Pin :: new ( & mut self . inner ) . poll_read ( cx, vbuf. unfilled ( ) ) {
1146
1150
Poll :: Ready ( Ok ( ( ) ) ) => {
1147
- /*
1148
- log::trace!("{:08x} read: {:?}", self.id, Escape(buf.filled()));
1149
- */
1150
- log:: trace!( "TODO: verbose poll_read" ) ;
1151
+ log:: trace!( "{:08x} read: {:?}" , self . id, Escape ( vbuf. filled( ) ) ) ;
1152
+ let len = vbuf. filled ( ) . len ( ) ;
1153
+ // SAFETY: The two cursors were for the same buffer. What was
1154
+ // filled in one is safe in the other.
1155
+ unsafe {
1156
+ buf. advance ( len) ;
1157
+ }
1151
1158
Poll :: Ready ( Ok ( ( ) ) )
1152
1159
}
1153
1160
Poll :: Ready ( Err ( e) ) => Poll :: Ready ( Err ( e) ) ,
You can’t perform that action at this time.
0 commit comments