[#5313] Correctly catch errors during bootstrap.

Motivation:

We not correctly catched errors during resolving in bootstrap and so may not have notified the future correctly.

Modifications:

Move code into try / catch block and try to fail the promise.

Result:

Promise is always notified
This commit is contained in:
Norman Maurer 2016-05-27 19:42:31 +02:00
parent 0b8a647f4e
commit f8b306f61c

View File

@ -194,6 +194,7 @@ public class Bootstrap extends AbstractBootstrap<Bootstrap, Channel> {
private ChannelFuture doResolveAndConnect0(final Channel channel, SocketAddress remoteAddress,
final SocketAddress localAddress, final ChannelPromise promise) {
try {
final EventLoop eventLoop = channel.eventLoop();
final AddressResolver<SocketAddress> resolver = this.resolver.getResolver(eventLoop);
@ -231,7 +232,9 @@ public class Bootstrap extends AbstractBootstrap<Bootstrap, Channel> {
}
}
});
} catch (Throwable cause) {
promise.tryFailure(cause);
}
return promise;
}