File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change 11use std:: io;
22use std:: pin:: Pin ;
3- use std:: task:: { Context , Poll } ;
3+ use std:: task:: { Context , Poll , ready } ;
44
55use tokio:: io:: AsyncRead ;
6- use tokio:: sync:: mpsc:: error:: TryRecvError ;
76
87use super :: { ChannelAsMut , ChannelMsg } ;
98use crate :: ChannelId ;
4342 ) -> Poll < io:: Result < ( ) > > {
4443 let ( msg, mut idx) = match self . buffer . take ( ) {
4544 Some ( msg) => msg,
46- None => match self . channel . as_mut ( ) . receiver . try_recv ( ) {
47- Ok ( msg) => ( msg, 0 ) ,
48- Err ( TryRecvError :: Empty ) => {
49- cx. waker ( ) . wake_by_ref ( ) ;
50- return Poll :: Pending ;
51- }
52- Err ( TryRecvError :: Disconnected ) => {
53- return Poll :: Ready ( Ok ( ( ) ) ) ;
54- }
45+ None => match ready ! ( self . channel. as_mut( ) . receiver. poll_recv( cx) ) {
46+ Some ( msg) => ( msg, 0 ) ,
47+ None => return Poll :: Ready ( Ok ( ( ) ) ) ,
5548 } ,
5649 } ;
5750
You can’t perform that action at this time.
0 commit comments