@@ -404,28 +404,6 @@ struct ConsensusNetworkingInstance {
404404 _drop_signal : exit_future:: Signal ,
405405}
406406
407- /// A utility future that resolves when the receiving end of a channel has hung up.
408- ///
409- /// This is an `.await`-friendly interface around `poll_canceled`.
410- // TODO: remove in favor of https://github.com/rust-lang/futures-rs/pull/2092/
411- // once published.
412- #[ must_use = "futures do nothing unless you `.await` or poll them" ]
413- #[ derive( Debug ) ]
414- pub struct AwaitCanceled < ' a , T > {
415- inner : & ' a mut oneshot:: Sender < T > ,
416- }
417-
418- impl < T > Future for AwaitCanceled < ' _ , T > {
419- type Output = ( ) ;
420-
421- fn poll (
422- mut self : Pin < & mut Self > ,
423- cx : & mut futures:: task:: Context < ' _ > ,
424- ) -> futures:: task:: Poll < ( ) > {
425- self . inner . poll_canceled ( cx)
426- }
427- }
428-
429407/// Protocol configuration.
430408#[ derive( Default ) ]
431409pub struct Config {
@@ -947,7 +925,7 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where
947925 self . executor . spawn (
948926 "polkadot-fetch-pov-block" ,
949927 async move {
950- let res = future:: select ( get_msg, AwaitCanceled { inner : & mut sender } ) . await ;
928+ let res = future:: select ( get_msg, sender. cancellation ( ) ) . await ;
951929 if let Either :: Left ( ( pov_block, _) ) = res {
952930 let _ = sender. send ( pov_block) ;
953931 }
@@ -981,7 +959,7 @@ impl<Api, Sp, Gossip> Worker<Api, Sp, Gossip> where
981959 self . executor . spawn (
982960 "polkadot-fetch-erasure-chunk" ,
983961 async move {
984- let res = future:: select ( get_msg, AwaitCanceled { inner : & mut sender } ) . await ;
962+ let res = future:: select ( get_msg, sender. cancellation ( ) ) . await ;
985963 if let Either :: Left ( ( chunk, _) ) = res {
986964 let _ = sender. send ( chunk) ;
987965 }
0 commit comments