mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 07:15:54 -04:00
Fix auth handshake, add missing img
This commit is contained in:
parent
d666c6cd3b
commit
7c4bf8680b
@ -67,6 +67,10 @@ To run it use:
|
||||
|
||||
$ java -jar gui/target/shaded.jar
|
||||
|
||||
For developing the following program arguments are useful (regtest mode):
|
||||
|
||||
$ java -jar gui/target/shaded.jar --bitcoin.network=regtest --useLocalhost=true --node.port=2222 --devTest=true --app.name=Bitsquare-Regtest-Alice
|
||||
|
||||
Problems?
|
||||
---------
|
||||
|
||||
|
@ -74,8 +74,8 @@
|
||||
</GridPane.margin>
|
||||
</TextField>
|
||||
|
||||
<Label text="Authenticated peers:" GridPane.rowIndex="5"/>
|
||||
<TextArea fx:id="authenticatedPeersTextArea" GridPane.rowIndex="7" GridPane.columnIndex="1"
|
||||
<Label text="Authenticated peers:" GridPane.rowIndex="4"/>
|
||||
<TextArea fx:id="authenticatedPeersTextArea" GridPane.rowIndex="4" GridPane.columnIndex="1"
|
||||
mouseTransparent="true" focusTraversable="false"/>
|
||||
|
||||
<columnConstraints>
|
||||
|
BIN
gui/src/main/resources/images/connection/tor.png
Normal file
BIN
gui/src/main/resources/images/connection/tor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
gui/src/main/resources/images/connection/tor@2x.png
Normal file
BIN
gui/src/main/resources/images/connection/tor@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
@ -21,13 +21,13 @@ import java.util.*;
|
||||
|
||||
|
||||
// authentication example:
|
||||
// node2 -> node1 RequestAuthenticationMessage
|
||||
// node2 -> node1 AuthenticationRequest
|
||||
// node1: close connection
|
||||
// node1 -> node2 ChallengeMessage on new connection
|
||||
// node1 -> node2 AuthenticationResponse on new connection
|
||||
// node2: authentication to node1 done if nonce ok
|
||||
// node2 -> node1 GetPeersMessage
|
||||
// node2 -> node1 GetPeersAuthRequest
|
||||
// node1: authentication to node2 done if nonce ok
|
||||
// node1 -> node2 PeersMessage
|
||||
// node1 -> node2 GetPeersAuthResponse
|
||||
|
||||
public class AuthenticationHandshake implements MessageListener {
|
||||
private static final Logger log = LoggerFactory.getLogger(AuthenticationHandshake.class);
|
||||
@ -77,12 +77,12 @@ public class AuthenticationHandshake implements MessageListener {
|
||||
Futures.addCallback(future, new FutureCallback<Connection>() {
|
||||
@Override
|
||||
public void onSuccess(Connection connection) {
|
||||
log.trace("GetPeersMessage sent successfully from " + myAddress + " to " + peerAddress);
|
||||
log.trace("GetPeersAuthRequest sent successfully from " + myAddress + " to " + peerAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable throwable) {
|
||||
log.info("GetPeersMessage sending failed " + throwable.getMessage());
|
||||
log.info("GetPeersAuthRequest sending failed " + throwable.getMessage());
|
||||
onFault(throwable);
|
||||
}
|
||||
});
|
||||
@ -104,17 +104,17 @@ public class AuthenticationHandshake implements MessageListener {
|
||||
|
||||
SettableFuture<Connection> future = networkNode.sendMessage(peerAddress,
|
||||
new GetPeersAuthResponse(myAddress, new HashSet<>(peerGroup.getAllPeerAddresses())));
|
||||
log.trace("sent PeersMessage to " + peerAddress + " from " + myAddress
|
||||
log.trace("sent GetPeersAuthResponse to " + peerAddress + " from " + myAddress
|
||||
+ " with allPeers=" + peerGroup.getAllPeerAddresses());
|
||||
Futures.addCallback(future, new FutureCallback<Connection>() {
|
||||
@Override
|
||||
public void onSuccess(Connection connection) {
|
||||
log.trace("PeersMessage sent successfully from " + myAddress + " to " + peerAddress);
|
||||
log.trace("GetPeersAuthResponse sent successfully from " + myAddress + " to " + peerAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Throwable throwable) {
|
||||
log.info("PeersMessage sending failed " + throwable.getMessage());
|
||||
log.info("GetPeersAuthResponse sending failed " + throwable.getMessage());
|
||||
onFault(throwable);
|
||||
}
|
||||
});
|
||||
@ -132,16 +132,16 @@ public class AuthenticationHandshake implements MessageListener {
|
||||
// Requesting peer
|
||||
GetPeersAuthResponse getPeersAuthResponse = (GetPeersAuthResponse) message;
|
||||
Address peerAddress = getPeersAuthResponse.address;
|
||||
log.trace("PeersMessage from " + peerAddress + " at " + myAddress);
|
||||
log.trace("GetPeersAuthResponse from " + peerAddress + " at " + myAddress);
|
||||
HashSet<Address> peerAddresses = getPeersAuthResponse.peerAddresses;
|
||||
log.trace("Received peers: " + peerAddresses);
|
||||
peerGroup.addToReportedPeers(peerAddresses, connection);
|
||||
|
||||
// we wait until the handshake is completed before setting the authenticate flag
|
||||
// authentication at both sides of the connection
|
||||
log.info("\n\nAuthenticationComplete\nPeer with address " + peerAddress
|
||||
log.info("AuthenticationComplete: Peer with address " + peerAddress
|
||||
+ " authenticated (" + connection.objectId + "). Took "
|
||||
+ (System.currentTimeMillis() - startAuthTs) + " ms. \n\n");
|
||||
+ (System.currentTimeMillis() - startAuthTs) + " ms.");
|
||||
|
||||
onSuccess(connection);
|
||||
}
|
||||
@ -176,7 +176,7 @@ public class AuthenticationHandshake implements MessageListener {
|
||||
}
|
||||
|
||||
public SettableFuture<Connection> requestAuthentication(Set<Address> remainingAddresses, Address peerAddress) {
|
||||
Log.traceCall();
|
||||
Log.traceCall(peerAddress.getFullAddress());
|
||||
// Requesting peer
|
||||
resultFuture = SettableFuture.create();
|
||||
startAuthTs = System.currentTimeMillis();
|
||||
@ -193,8 +193,9 @@ public class AuthenticationHandshake implements MessageListener {
|
||||
log.info("Send RequestAuthenticationMessage to " + peerAddress + " failed." +
|
||||
"\nThat is expected if seed nodes are offline." +
|
||||
"\nException:" + throwable.getMessage());
|
||||
log.trace("We try to authenticate to another random seed nodes of that list: " + remainingAddresses);
|
||||
authenticateToNextRandomPeer(remainingAddresses);
|
||||
onFault(throwable);
|
||||
// log.trace("We try to authenticate to another random seed nodes of that list: " + remainingAddresses);
|
||||
// authenticateToNextRandomPeer(remainingAddresses);
|
||||
}
|
||||
});
|
||||
|
||||
@ -267,7 +268,7 @@ public class AuthenticationHandshake implements MessageListener {
|
||||
// Private
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void authenticateToNextRandomPeer(Set<Address> remainingAddresses) {
|
||||
/* private void authenticateToNextRandomPeer(Set<Address> remainingAddresses) {
|
||||
Log.traceCall();
|
||||
Optional<Tuple2<Address, Set<Address>>> tupleOptional = getRandomAddressAndRemainingSet(remainingAddresses);
|
||||
if (tupleOptional.isPresent()) {
|
||||
@ -277,7 +278,7 @@ public class AuthenticationHandshake implements MessageListener {
|
||||
log.info("No other seed node found. That is expected for the first seed node.");
|
||||
onSuccess(null);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
private Optional<Tuple2<Address, Set<Address>>> getRandomAddressAndRemainingSet(Set<Address> addresses) {
|
||||
Log.traceCall();
|
||||
|
@ -17,7 +17,7 @@ public final class AuthenticationRequest implements AuthenticationMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RequestAuthenticationMessage{" +
|
||||
return "AuthenticationRequest{" +
|
||||
"address=" + address +
|
||||
", nonce=" + nonce +
|
||||
'}';
|
||||
|
@ -19,7 +19,7 @@ public final class AuthenticationResponse implements AuthenticationMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChallengeMessage{" +
|
||||
return "AuthenticationResponse{" +
|
||||
"address=" + address +
|
||||
", requesterNonce=" + requesterNonce +
|
||||
", challengerNonce=" + challengerNonce +
|
||||
|
@ -21,7 +21,7 @@ public final class GetPeersAuthRequest implements AuthenticationMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GetPeersMessage{" +
|
||||
return "GetPeersAuthRequest{" +
|
||||
"address=" + address +
|
||||
", challengerNonce=" + challengerNonce +
|
||||
", peerAddresses=" + peerAddresses +
|
||||
|
@ -19,7 +19,7 @@ public final class GetPeersAuthResponse implements AuthenticationMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PeersMessage{" + "peerAddresses=" + peerAddresses + '}';
|
||||
return "GetPeersAuthResponse{" + "peerAddresses=" + peerAddresses + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public final class GetPeersRequest implements MaintenanceMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GetPeersMessage{" +
|
||||
return "GetPeersRequest{" +
|
||||
"address=" + address +
|
||||
", peerAddresses=" + peerAddresses +
|
||||
'}';
|
||||
|
@ -17,7 +17,7 @@ public final class GetPeersResponse implements MaintenanceMessage {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GetPeersMessage{" +
|
||||
return "GetPeersResponse{" +
|
||||
", peerAddresses=" + peerAddresses +
|
||||
'}';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user