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 {
112
112
if control. recv_buffer . is_empty ( ) {
113
113
// Nothing could be read. Wait for notify.
114
114
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
+ }
116
118
}
117
119
118
120
return Poll :: Pending ;
@@ -138,7 +140,9 @@ impl AsyncWrite for TcpConnection {
138
140
139
141
if control. send_buffer . is_full ( ) {
140
142
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
+ }
142
146
}
143
147
144
148
return Poll :: Pending ;
@@ -163,7 +167,9 @@ impl AsyncWrite for TcpConnection {
163
167
164
168
control. is_closed = true ;
165
169
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
+ }
167
173
}
168
174
169
175
Poll :: Pending
You can’t perform that action at this time.
0 commit comments