Ensure DNS errors bubble up as errors in reactive streams
Currently DNS lookups happen synchronously in the reactive streams
driver.  This isn't good, but with this change at least DNS errors
will be properly reported.
@@ -164,10 +164,6 @@ public class InternalStreamConnection implements InternalConnection {
isTrue("Open already called", stream == null, callback);
try {
stream = streamFactory.create(serverId.getAddress());
- } catch (Throwable t) {
- callback.onResult(null, t);
- return;
- }
stream.openAsync(new AsyncCompletionHandler<Void>() {
@Override
public void completed(final Void aVoid) {
@@ -197,6 +193,9 @@ public class InternalStreamConnection implements InternalConnection {
callback.onResult(null, t);
}
});
+ } catch (Throwable t) {
+ callback.onResult(null, t);
+ }
}
private Map<Byte, Compressor> createCompressorMap(final List<MongoCompressor> compressorList) {
