Commit 56f0bcfe authored by Andreas Schildbach's avatar Andreas Schildbach

Peer: Change getVersionHandshakeFuture() return type back to ListenableFuture<Peer>.

parent a71da1b8
...@@ -160,8 +160,18 @@ public class Peer extends PeerSocketHandler { ...@@ -160,8 +160,18 @@ public class Peer extends PeerSocketHandler {
private final SettableFuture<Peer> connectionOpenFuture = SettableFuture.create(); private final SettableFuture<Peer> connectionOpenFuture = SettableFuture.create();
private final SettableFuture<Peer> outgoingVersionHandshakeFuture = SettableFuture.create(); private final SettableFuture<Peer> outgoingVersionHandshakeFuture = SettableFuture.create();
private final SettableFuture<Peer> incomingVersionHandshakeFuture = SettableFuture.create(); private final SettableFuture<Peer> incomingVersionHandshakeFuture = SettableFuture.create();
private final ListenableFuture<List<Peer>> versionHandshakeFuture = Futures private final ListenableFuture<Peer> versionHandshakeFuture = Futures.transform(
.allAsList(outgoingVersionHandshakeFuture, incomingVersionHandshakeFuture); Futures.allAsList(outgoingVersionHandshakeFuture, incomingVersionHandshakeFuture),
new Function<List<Peer>, Peer>() {
@Override
@Nullable
public Peer apply(@Nullable List<Peer> peers) {
checkNotNull(peers);
checkState(peers.size() == 2 && peers.get(0) == peers.get(1));
return peers.get(0);
}
});
/** /**
* <p>Construct a peer that reads/writes from the given block chain.</p> * <p>Construct a peer that reads/writes from the given block chain.</p>
...@@ -436,7 +446,7 @@ public class Peer extends PeerSocketHandler { ...@@ -436,7 +446,7 @@ public class Peer extends PeerSocketHandler {
return connectionOpenFuture; return connectionOpenFuture;
} }
public ListenableFuture<List<Peer>> getVersionHandshakeFuture() { public ListenableFuture<Peer> getVersionHandshakeFuture() {
return versionHandshakeFuture; return versionHandshakeFuture;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment