projects
/
jFCPlib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add method to modify peer by node identity
[jFCPlib.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
fcp
/
quelaton
/
ClientHelloImpl.java
diff --git
a/src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java
b/src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java
index
9c03291
..
3ded685
100644
(file)
--- a/
src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java
+++ b/
src/main/java/net/pterodactylus/fcp/quelaton/ClientHelloImpl.java
@@
-3,11
+3,9
@@
package net.pterodactylus.fcp.quelaton;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import net.pterodactylus.fcp.ClientHello;
import java.util.concurrent.atomic.AtomicReference;
import net.pterodactylus.fcp.ClientHello;
-import net.pterodactylus.fcp.CloseConnectionDuplicateClientName;
import net.pterodactylus.fcp.FcpConnection;
import net.pterodactylus.fcp.NodeHello;
import net.pterodactylus.fcp.FcpConnection;
import net.pterodactylus.fcp.NodeHello;
@@
-16,7
+14,7
@@
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
/**
import com.google.common.util.concurrent.MoreExecutors;
/**
- * Internal <code>ClientHello</code> implementation based on {@link Fcp
ReplySequence
}.
+ * Internal <code>ClientHello</code> implementation based on {@link Fcp
Dialog
}.
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
*
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
@@
-39,15
+37,14
@@
public class ClientHelloImpl {
}
private ListenableFuture<FcpConnection> execute() {
}
private ListenableFuture<FcpConnection> execute() {
- return threadPool.submit(
() -> establishConnection()
);
+ return threadPool.submit(
this::establishConnection
);
}
private FcpConnection establishConnection() throws IOException {
FcpConnection connection = new FcpConnection(hostname, port);
connection.connect();
}
private FcpConnection establishConnection() throws IOException {
FcpConnection connection = new FcpConnection(hostname, port);
connection.connect();
- ClientHelloReplySequence nodeHelloSequence = new ClientHelloReplySequence(connection);
ClientHello clientHello = new ClientHello(clientName.get(), "2.0");
ClientHello clientHello = new ClientHello(clientName.get(), "2.0");
- try {
+ try
(ClientHelloDialog nodeHelloSequence = new ClientHelloDialog(connection))
{
if (nodeHelloSequence.send(clientHello).get()) {
return connection;
}
if (nodeHelloSequence.send(clientHello).get()) {
return connection;
}
@@
-59,18
+56,17
@@
public class ClientHelloImpl {
throw new IOException(String.format("Could not connect to %s:%d.", hostname, port));
}
throw new IOException(String.format("Could not connect to %s:%d.", hostname, port));
}
- private class ClientHello
ReplySequence extends FcpReplySequence
<Boolean> {
+ private class ClientHello
Dialog extends FcpDialog
<Boolean> {
private final AtomicReference<NodeHello> receivedNodeHello = new AtomicReference<>();
private final AtomicReference<NodeHello> receivedNodeHello = new AtomicReference<>();
- private final AtomicBoolean receivedClosed = new AtomicBoolean();
- public ClientHello
ReplySequence
(FcpConnection connection) {
+ public ClientHello
Dialog
(FcpConnection connection) {
super(ClientHelloImpl.this.threadPool, connection);
}
@Override
protected boolean isFinished() {
super(ClientHelloImpl.this.threadPool, connection);
}
@Override
protected boolean isFinished() {
- return receivedNodeHello.get() != null
|| receivedClosed.get()
;
+ return receivedNodeHello.get() != null;
}
@Override
}
@Override
@@
-83,12
+79,6
@@
public class ClientHelloImpl {
receivedNodeHello.set(nodeHello);
}
receivedNodeHello.set(nodeHello);
}
- @Override
- protected void consumeCloseConnectionDuplicateClientName(
- CloseConnectionDuplicateClientName closeConnectionDuplicateClientName) {
- receivedClosed.set(true);
- }
-
}
}
}
}