File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
crates/shadowsocks-service/src/local/tun Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,9 @@ impl AsyncRead for TcpConnection {
112112 if control. recv_buffer . is_empty ( ) {
113113 // Nothing could be read. Wait for notify.
114114 if let Some ( old_waker) = control. recv_waker . replace ( cx. waker ( ) . clone ( ) ) {
115- old_waker. wake ( ) ;
115+ if !old_waker. will_wake ( cx. waker ( ) ) {
116+ old_waker. wake ( ) ;
117+ }
116118 }
117119
118120 return Poll :: Pending ;
@@ -138,7 +140,9 @@ impl AsyncWrite for TcpConnection {
138140
139141 if control. send_buffer . is_full ( ) {
140142 if let Some ( old_waker) = control. send_waker . replace ( cx. waker ( ) . clone ( ) ) {
141- old_waker. wake ( ) ;
143+ if !old_waker. will_wake ( cx. waker ( ) ) {
144+ old_waker. wake ( ) ;
145+ }
142146 }
143147
144148 return Poll :: Pending ;
@@ -163,7 +167,9 @@ impl AsyncWrite for TcpConnection {
163167
164168 control. is_closed = true ;
165169 if let Some ( old_waker) = control. send_waker . replace ( cx. waker ( ) . clone ( ) ) {
166- old_waker. wake ( ) ;
170+ if !old_waker. will_wake ( cx. waker ( ) ) {
171+ old_waker. wake ( ) ;
172+ }
167173 }
168174
169175 Poll :: Pending
You can’t perform that action at this time.
0 commit comments