Make sure Channel connected event is not fired on connect failure. See #249
This commit is contained in:
parent
049fb35bc1
commit
db87c6ea37
@ -215,7 +215,6 @@ public class SctpWorker extends NioWorker {
|
|||||||
protected void connect(SelectionKey k) {
|
protected void connect(SelectionKey k) {
|
||||||
final SctpClientChannel ch = (SctpClientChannel) k.attachment();
|
final SctpClientChannel ch = (SctpClientChannel) k.attachment();
|
||||||
try {
|
try {
|
||||||
// TODO: Remove cast
|
|
||||||
if (ch.getJdkChannel().finishConnect()) {
|
if (ch.getJdkChannel().finishConnect()) {
|
||||||
registerTask(ch, ch.connectFuture);
|
registerTask(ch, ch.connectFuture);
|
||||||
}
|
}
|
||||||
@ -358,7 +357,13 @@ public class SctpWorker extends NioWorker {
|
|||||||
((SctpChannelImpl) channel).setConnected();
|
((SctpChannelImpl) channel).setConnected();
|
||||||
future.setSuccess();
|
future.setSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!server) {
|
||||||
|
if (!((SctpClientChannel) channel).boundManually) {
|
||||||
|
fireChannelBound(channel, localAddress);
|
||||||
|
}
|
||||||
|
fireChannelConnected(channel, remoteAddress);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (future != null) {
|
if (future != null) {
|
||||||
future.setFailure(e);
|
future.setFailure(e);
|
||||||
@ -369,13 +374,6 @@ public class SctpWorker extends NioWorker {
|
|||||||
"Failed to register a socket to the selector.", e);
|
"Failed to register a socket to the selector.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!server) {
|
|
||||||
if (!((SctpClientChannel) channel).boundManually) {
|
|
||||||
fireChannelBound(channel, localAddress);
|
|
||||||
}
|
|
||||||
fireChannelConnected(channel, remoteAddress);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -140,6 +140,10 @@ public class NioWorker extends SelectorEventLoop {
|
|||||||
}
|
}
|
||||||
future.setSuccess();
|
future.setSuccess();
|
||||||
}
|
}
|
||||||
|
if (server || !((NioClientSocketChannel) channel).boundManually) {
|
||||||
|
fireChannelBound(channel, localAddress);
|
||||||
|
}
|
||||||
|
fireChannelConnected(channel, remoteAddress);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (future != null) {
|
if (future != null) {
|
||||||
@ -151,11 +155,6 @@ public class NioWorker extends SelectorEventLoop {
|
|||||||
"Failed to register a socket to the selector.", e);
|
"Failed to register a socket to the selector.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server || !((NioClientSocketChannel) channel).boundManually) {
|
|
||||||
fireChannelBound(channel, localAddress);
|
|
||||||
}
|
|
||||||
fireChannelConnected(channel, remoteAddress);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user