mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-28 16:47:25 -04:00
Disable relay mode
This commit is contained in:
parent
eee523e8b3
commit
dd80d3edf3
1 changed files with 17 additions and 8 deletions
|
@ -46,7 +46,6 @@ import net.tomp2p.futures.BaseFutureListener;
|
||||||
import net.tomp2p.futures.FutureBootstrap;
|
import net.tomp2p.futures.FutureBootstrap;
|
||||||
import net.tomp2p.futures.FutureDiscover;
|
import net.tomp2p.futures.FutureDiscover;
|
||||||
import net.tomp2p.nat.FutureNAT;
|
import net.tomp2p.nat.FutureNAT;
|
||||||
import net.tomp2p.nat.FutureRelayNAT;
|
|
||||||
import net.tomp2p.nat.PeerBuilderNAT;
|
import net.tomp2p.nat.PeerBuilderNAT;
|
||||||
import net.tomp2p.nat.PeerNAT;
|
import net.tomp2p.nat.PeerNAT;
|
||||||
import net.tomp2p.p2p.Peer;
|
import net.tomp2p.p2p.Peer;
|
||||||
|
@ -188,9 +187,10 @@ class BootstrappedPeerFactory {
|
||||||
lastSuccessfulBootstrap = BootstrapState.DIRECT_SUCCESS;
|
lastSuccessfulBootstrap = BootstrapState.DIRECT_SUCCESS;
|
||||||
|
|
||||||
switch (lastSuccessfulBootstrap) {
|
switch (lastSuccessfulBootstrap) {
|
||||||
case RELAY_SUCCESS:
|
// For the moment we don't support relay mode as it has too much problems
|
||||||
|
/* case RELAY_SUCCESS:
|
||||||
bootstrapWithRelay();
|
bootstrapWithRelay();
|
||||||
break;
|
break;*/
|
||||||
case AUTO_PORT_FORWARDING_SUCCESS:
|
case AUTO_PORT_FORWARDING_SUCCESS:
|
||||||
tryPortForwarding();
|
tryPortForwarding();
|
||||||
break;
|
break;
|
||||||
|
@ -260,9 +260,16 @@ class BootstrappedPeerFactory {
|
||||||
discoverAfterPortForwarding();
|
discoverAfterPortForwarding();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setState(BootstrapState.AUTO_PORT_FORWARDING_NOT_SUCCEEDED, "Port forwarding has failed. " +
|
handleError(BootstrapState.AUTO_PORT_FORWARDING_FAILED, "Automatic port forwarding failed. " +
|
||||||
|
"Fail reason: " + future.failedReason() +
|
||||||
|
"\nCheck if UPnP is not enabled on your router. " +
|
||||||
|
"\nYou can try also to setup manual port forwarding. " +
|
||||||
|
"\nRelay mode is currently not supported but will follow later. ");
|
||||||
|
|
||||||
|
// For the moment we don't support relay mode as it has too much problems
|
||||||
|
/* setState(BootstrapState.AUTO_PORT_FORWARDING_NOT_SUCCEEDED, "Port forwarding has failed. " +
|
||||||
"We try to use a relay as next step.");
|
"We try to use a relay as next step.");
|
||||||
bootstrapWithRelay();
|
bootstrapWithRelay();*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,7 +293,8 @@ class BootstrappedPeerFactory {
|
||||||
bootstrap(BootstrapState.AUTO_PORT_FORWARDING_SUCCESS);
|
bootstrap(BootstrapState.AUTO_PORT_FORWARDING_SUCCESS);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
handleError(BootstrapState.AUTO_PORT_FORWARDING_FAILED, "Discover with automatic port forwarding has failed " +
|
handleError(BootstrapState.AUTO_PORT_FORWARDING_FAILED, "Discover with automatic port forwarding " +
|
||||||
|
"has failed " +
|
||||||
futureDiscover.failedReason());
|
futureDiscover.failedReason());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,8 +306,9 @@ class BootstrappedPeerFactory {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For the moment we don't support relay mode as it has too much problems
|
||||||
// 3. Attempt: We try to use another peer as relay
|
// 3. Attempt: We try to use another peer as relay
|
||||||
private void bootstrapWithRelay() {
|
/* private void bootstrapWithRelay() {
|
||||||
setState(BootstrapState.RELAY_INIT, "We try to use another peer as relay.");
|
setState(BootstrapState.RELAY_INIT, "We try to use another peer as relay.");
|
||||||
FutureDiscover futureDiscover = peer.discover().peerAddress(getBootstrapAddress()).start();
|
FutureDiscover futureDiscover = peer.discover().peerAddress(getBootstrapAddress()).start();
|
||||||
PeerNAT peerNAT = new PeerBuilderNAT(peer).start();
|
PeerNAT peerNAT = new PeerBuilderNAT(peer).start();
|
||||||
|
@ -323,7 +332,7 @@ class BootstrappedPeerFactory {
|
||||||
handleError(BootstrapState.RELAY_FAILED, "Exception at bootstrapWithRelay: " + t.getMessage());
|
handleError(BootstrapState.RELAY_FAILED, "Exception at bootstrapWithRelay: " + t.getMessage());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private void bootstrap(BootstrapState state) {
|
private void bootstrap(BootstrapState state) {
|
||||||
FutureBootstrap futureBootstrap = peer.bootstrap().peerAddress(getBootstrapAddress()).start();
|
FutureBootstrap futureBootstrap = peer.bootstrap().peerAddress(getBootstrapAddress()).start();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue