File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ impl IpStackConfig {
8383
8484pub struct IpStack {
8585 accept_receiver : UnboundedReceiver < IpStackStream > ,
86- _handle : JoinHandle < Result < ( ) > > , // Just hold the task handle
86+ handle : JoinHandle < Result < ( ) > > ,
8787}
8888
8989impl IpStack {
@@ -94,13 +94,17 @@ impl IpStack {
9494 let ( accept_sender, accept_receiver) = mpsc:: unbounded_channel :: < IpStackStream > ( ) ;
9595 IpStack {
9696 accept_receiver,
97- _handle : run ( config, device, accept_sender) ,
97+ handle : run ( config, device, accept_sender) ,
9898 }
9999 }
100100
101101 pub async fn accept ( & mut self ) -> Result < IpStackStream , IpStackError > {
102102 self . accept_receiver . recv ( ) . await . ok_or ( IpStackError :: AcceptError )
103103 }
104+
105+ pub fn abort ( self ) {
106+ self . handle . abort ( ) ;
107+ }
104108}
105109
106110fn run < Device : AsyncRead + AsyncWrite + Unpin + Send + ' static > (
You can’t perform that action at this time.
0 commit comments