Skip to content

Commit

Permalink
[ISSUE #8366] When determining if ChannelWrapper is the wrapper for…
Browse files Browse the repository at this point in the history
… a channel, no longer acquire a read lock.
  • Loading branch information
YanYunyang committed Jul 5, 2024
1 parent 77d6633 commit 32f0e84
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,12 +463,10 @@ public void closeChannel(final Channel channel) {
for (Map.Entry<String, ChannelWrapper> entry : channelTables.entrySet()) {
String key = entry.getKey();
ChannelWrapper prev = entry.getValue();
if (prev.getChannel() != null) {
if (prev.getChannel() == channel) {
prevCW = prev;
addrRemote = key;
break;
}
if (prev.isWrapperOf(channel)) {
prevCW = prev;
addrRemote = key;
break;
}
}

Expand Down Expand Up @@ -1022,6 +1020,13 @@ public boolean isWritable() {
return getChannel().isWritable();
}

public boolean isWrapperOf(Channel channel) {
if (this.channelFuture.channel() != null && this.channelFuture.channel() == channel) {
return true;
}
return false;
}

private Channel getChannel() {
return getChannelFuture().channel();
}
Expand Down

0 comments on commit 32f0e84

Please sign in to comment.