mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
Payment channels: log connection failures in NioClient
This commit is contained in:
parent
2fd565c366
commit
16f953c6c1
@ -17,14 +17,20 @@
|
||||
|
||||
package org.bitcoinj.net;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import com.google.common.base.*;
|
||||
import com.google.common.util.concurrent.*;
|
||||
import org.slf4j.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.nio.*;
|
||||
|
||||
/**
|
||||
* Creates a simple connection to a server using a {@link StreamParser} to process data.
|
||||
*/
|
||||
public class NioClient implements MessageWriteTarget {
|
||||
private static final Logger log = LoggerFactory.getLogger(NioClient.class);
|
||||
|
||||
private final Handler handler;
|
||||
private final NioClientManager manager = new NioClientManager();
|
||||
|
||||
@ -96,7 +102,16 @@ public class NioClient implements MessageWriteTarget {
|
||||
manager.startAsync();
|
||||
manager.awaitRunning();
|
||||
handler = new Handler(parser, connectTimeoutMillis);
|
||||
manager.openConnection(serverAddress, handler);
|
||||
Futures.addCallback(manager.openConnection(serverAddress, handler), new FutureCallback<SocketAddress>() {
|
||||
@Override
|
||||
public void onSuccess(SocketAddress result) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable t) {
|
||||
log.error("Connect to {} failed: {}", serverAddress, Throwables.getRootCause(t));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user