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,7 +94,7 @@ 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
@@ -103,6 +103,12 @@ impl IpStack {
103103 }
104104}
105105
106+ impl Drop for IpStack {
107+ fn drop ( & mut self ) {
108+ self . handle . abort ( ) ;
109+ }
110+ }
111+
106112fn run < Device : AsyncRead + AsyncWrite + Unpin + Send + ' static > (
107113 config : IpStackConfig ,
108114 mut device : Device ,
You can’t perform that action at this time.
0 commit comments