@@ -50,8 +50,6 @@ struct StreamOpsInner {
5050 delayed_drop : Cell < bool > ,
5151 delayed_feed : Cell < Option < Vec < IdType > > > ,
5252 streams : Cell < Option < Box < Slab < StreamItem > > > > ,
53- lw : usize ,
54- hw : usize ,
5553}
5654
5755impl StreamOps {
@@ -65,8 +63,6 @@ impl StreamOps {
6563 delayed_drop : Cell :: new ( false ) ,
6664 delayed_feed : Cell :: new ( Some ( Vec :: new ( ) ) ) ,
6765 streams : Cell :: new ( Some ( Box :: new ( Slab :: new ( ) ) ) ) ,
68- lw : 1024 ,
69- hw : 1024 * 16 ,
7066 } ) ;
7167 inner = Some ( ops. clone ( ) ) ;
7268 Box :: new ( StreamOpsHandler { inner : ops } )
@@ -131,21 +127,18 @@ impl Handler for StreamOpsHandler {
131127 log:: trace!( "{}: Event ({:?}): {ev:?} {:?}" , io. tag( ) , io. fd( ) , io. flags) ;
132128
133129 if ev. readable {
134- match io. read ( id as u32 , & self . inner . api , self . inner . lw , self . inner . hw ) {
135- IoTaskStatus :: Io => {
136- renew. readable = true ;
137- io. flags . insert ( Flags :: RD ) ;
138- }
139- IoTaskStatus :: Pause | IoTaskStatus :: Stop => {
140- io. flags . remove ( Flags :: RD ) ;
141- }
130+ if io. read ( ) . ready ( ) {
131+ renew. readable = true ;
132+ io. flags . insert ( Flags :: RD ) ;
133+ } else {
134+ io. flags . remove ( Flags :: RD ) ;
142135 }
143136 } else if io. flags . contains ( Flags :: RD ) {
144137 renew. readable = true ;
145138 }
146139
147140 if ev. writable {
148- if io. write ( id as u32 , & self . inner . api ) == IoTaskStatus :: Io {
141+ if io. write ( ) . ready ( ) {
149142 renew. writable = true ;
150143 io. flags . insert ( Flags :: WR ) ;
151144 } else {
@@ -248,7 +241,6 @@ impl StreamOpsInner {
248241 if let Some ( mut streams) = self . streams . take ( ) {
249242 let idx = id as usize ;
250243 let item = & mut streams[ idx] ;
251- let fd = item. fd ( ) ;
252244
253245 if item. flags . contains ( Flags :: DROPPED_PRI ) {
254246 let item = streams. remove ( idx) ;
@@ -298,7 +290,7 @@ impl StreamCtl {
298290 } )
299291 . await
300292 . map_err ( io:: Error :: other)
301- . and_then ( crate :: helpers :: pool_io_err )
293+ . and_then ( |res| res . map_err ( io :: Error :: other ) )
302294 }
303295
304296 /// Modify poll interest for the stream
@@ -318,9 +310,7 @@ impl StreamCtl {
318310 if io. flags . contains ( Flags :: RD ) {
319311 event. readable = true ;
320312 want_update_read = false ;
321- } else if io. read ( self . id , & self . inner . api , self . inner . lw , self . inner . hw )
322- == IoTaskStatus :: Io
323- {
313+ } else if io. read ( ) . ready ( ) {
324314 event. readable = true ;
325315 io. flags . insert ( Flags :: RD ) ;
326316 } else {
@@ -337,7 +327,7 @@ impl StreamCtl {
337327 if io. flags . contains ( Flags :: WR ) {
338328 event. writable = true ;
339329 want_update_write = false ;
340- } else if io. write ( self . id , & self . inner . api ) == IoTaskStatus :: Io {
330+ } else if io. write ( ) . ready ( ) {
341331 event. writable = true ;
342332 io. flags . insert ( Flags :: WR ) ;
343333 } else {
@@ -393,7 +383,7 @@ impl StreamItem {
393383 self . ctx . tag ( )
394384 }
395385
396- fn write ( & mut self , id : u32 , api : & DriverApi ) -> IoTaskStatus {
386+ fn write ( & mut self ) -> IoTaskStatus {
397387 if let Some ( buf) = self . ctx . get_write_buf ( ) {
398388 let fd = self . fd ( ) ;
399389 log:: trace!( "{}: Write ({fd:?}), buf: {:?}" , self . ctx. tag( ) , buf. len( ) ) ;
@@ -403,7 +393,7 @@ impl StreamItem {
403393 IoTaskStatus :: Pause
404394 }
405395
406- fn read ( & mut self , id : u32 , api : & DriverApi , lw : usize , hw : usize ) -> IoTaskStatus {
396+ fn read ( & mut self ) -> IoTaskStatus {
407397 let mut buf = self . ctx . get_read_buf ( ) ;
408398
409399 let fd = self . fd ( ) ;
0 commit comments