Skip to content

Commit ab1ba43

Browse files
committed
check waker before take (mem::replace)
1 parent caafcbc commit ab1ba43

File tree

1 file changed

+2
-2
lines changed
  • crates/shadowsocks-service/src/local/tun

1 file changed

+2
-2
lines changed

crates/shadowsocks-service/src/local/tun/tcp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl TcpTun {
338338
}
339339
}
340340

341-
if has_received {
341+
if has_received && control.recv_waker.is_some() {
342342
if let Some(waker) = control.recv_waker.take() {
343343
waker.wake();
344344
}
@@ -365,7 +365,7 @@ impl TcpTun {
365365
}
366366
}
367367

368-
if has_sent {
368+
if has_sent && control.send_waker.is_some() {
369369
if let Some(waker) = control.send_waker.take() {
370370
waker.wake();
371371
}

0 commit comments

Comments
 (0)