Fixed issue: NETTY-43 (channelBound event can be fired more than once for NIO client socket)
* Fixed NioWorker.register() to check NioClientSocketChannel.boundManually flag
This commit is contained in:
parent
384e08209e
commit
8b9f63e578
@ -113,9 +113,10 @@ class NioWorker implements Runnable {
|
|||||||
boolean server = !(channel instanceof NioClientSocketChannel);
|
boolean server = !(channel instanceof NioClientSocketChannel);
|
||||||
if (server) {
|
if (server) {
|
||||||
fireChannelOpen(channel);
|
fireChannelOpen(channel);
|
||||||
|
fireChannelBound(channel, channel.getLocalAddress());
|
||||||
|
} else if (!((NioClientSocketChannel) channel).boundManually) {
|
||||||
|
fireChannelBound(channel, channel.getLocalAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
fireChannelBound(channel, channel.getLocalAddress());
|
|
||||||
fireChannelConnected(channel, channel.getRemoteAddress());
|
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||||
|
|
||||||
String threadName =
|
String threadName =
|
||||||
@ -141,8 +142,13 @@ class NioWorker implements Runnable {
|
|||||||
"Failed to register a socket to the selector.", e);
|
"Failed to register a socket to the selector.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
fireChannelOpen(channel);
|
boolean server = !(channel instanceof NioClientSocketChannel);
|
||||||
fireChannelBound(channel, channel.getLocalAddress());
|
if (server) {
|
||||||
|
fireChannelOpen(channel);
|
||||||
|
fireChannelBound(channel, channel.getLocalAddress());
|
||||||
|
} else if (!((NioClientSocketChannel) channel).boundManually) {
|
||||||
|
fireChannelBound(channel, channel.getLocalAddress());
|
||||||
|
}
|
||||||
fireChannelConnected(channel, channel.getRemoteAddress());
|
fireChannelConnected(channel, channel.getRemoteAddress());
|
||||||
} finally {
|
} finally {
|
||||||
selectorGuard.readLock().unlock();
|
selectorGuard.readLock().unlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user