We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14ee30a commit 4bd4f10Copy full SHA for 4bd4f10
client/src/main/java/org/asynchttpclient/netty/NettyResponseFuture.java
@@ -187,10 +187,10 @@ public boolean cancel(boolean force) {
187
return false;
188
}
189
190
- // cancel could happen before channel was attached
191
- if (channel != null) {
192
- Channels.setDiscard(channel);
193
- Channels.silentlyCloseChannel(channel);
+ Channel ch = channel; //atomic read, so that it won't end up in TOCTOU
+ if (ch != null) {
+ Channels.setDiscard(ch);
+ Channels.silentlyCloseChannel(ch);
194
195
196
if (ON_THROWABLE_CALLED_FIELD.getAndSet(this, 1) == 0) {
0 commit comments