mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-30 02:08:58 -04:00
Deactivated port forwarding and isSuccess check because of a bug in TomP2P
This commit is contained in:
parent
de2563d4bf
commit
6a51dd154a
3 changed files with 34 additions and 13 deletions
|
@ -142,17 +142,30 @@ public class BootstrappedPeerFactory {
|
|||
persistence.write(this, "lastSuccessfulBootstrap", "default");
|
||||
bootstrapCounter = 0;
|
||||
}
|
||||
|
||||
persistence.write(this, "bootstrapCounter", bootstrapCounter);
|
||||
|
||||
|
||||
String lastSuccessfulBootstrap = (String) persistence.read(this, "lastSuccessfulBootstrap");
|
||||
if (lastSuccessfulBootstrap == null)
|
||||
lastSuccessfulBootstrap = "default";
|
||||
|
||||
log.debug("lastSuccessfulBootstrap = " + lastSuccessfulBootstrap);
|
||||
FutureDiscover futureDiscover;
|
||||
|
||||
// just temporary while port forwarding is not working
|
||||
switch (lastSuccessfulBootstrap) {
|
||||
case "relay":
|
||||
case "portForwarding":
|
||||
futureDiscover = peerDHT.peer().discover().peerAddress(getBootstrapAddress()).start();
|
||||
PeerNAT peerNAT = new PeerBuilderNAT(peerDHT.peer()).start();
|
||||
FutureNAT futureNAT = peerNAT.startSetupPortforwarding(futureDiscover);
|
||||
bootstrapWithRelay(peerDHT, peerNAT, futureDiscover, futureNAT);
|
||||
break;
|
||||
case "default":
|
||||
default:
|
||||
discover(peerDHT);
|
||||
break;
|
||||
}
|
||||
/* switch (lastSuccessfulBootstrap) {
|
||||
case "relay":
|
||||
futureDiscover = peerDHT.peer().discover().peerAddress(getBootstrapAddress()).start();
|
||||
PeerNAT peerNAT = new PeerBuilderNAT(peerDHT.peer()).start();
|
||||
|
@ -167,7 +180,7 @@ public class BootstrappedPeerFactory {
|
|||
default:
|
||||
discover(peerDHT);
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
} catch (IOException e) {
|
||||
setState("Cannot create peer with port: " + port + ". Exeption: " + e, false);
|
||||
settableFuture.setException(e);
|
||||
|
@ -192,7 +205,13 @@ public class BootstrappedPeerFactory {
|
|||
log.warn("Discover has failed. Reason: " + futureDiscover.failedReason());
|
||||
setState("We are probably behind a NAT and not reachable to other peers. " +
|
||||
"We try port forwarding as next step.");
|
||||
tryPortForwarding(peerDHT, futureDiscover);
|
||||
|
||||
// just temporary while port forwarding is not working
|
||||
//tryPortForwarding(peerDHT, futureDiscover);
|
||||
setState("Port forwarding has failed. We try to use a relay as next step.");
|
||||
PeerNAT peerNAT = new PeerBuilderNAT(peerDHT.peer()).start();
|
||||
FutureNAT futureNAT = peerNAT.startSetupPortforwarding(futureDiscover);
|
||||
bootstrapWithRelay(peerDHT, peerNAT, futureDiscover, futureNAT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,8 @@ public class MessageFacade implements MessageBroker {
|
|||
futurePut.addListener(new BaseFutureListener<BaseFuture>() {
|
||||
@Override
|
||||
public void operationComplete(BaseFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
// deactivate it for the moment until the port forwarding bug is fixed
|
||||
// if (future.isSuccess()) {
|
||||
Platform.runLater(() -> {
|
||||
addOfferListener.onComplete();
|
||||
offerBookListeners.stream().forEach(listener -> {
|
||||
|
@ -191,14 +192,14 @@ public class MessageFacade implements MessageBroker {
|
|||
log.trace("Add offer to DHT was successful. Added data: [locationKey: " + locationKey +
|
||||
", value: " + offerData + "]");
|
||||
});
|
||||
}
|
||||
/* }
|
||||
else {
|
||||
Platform.runLater(() -> {
|
||||
addOfferListener.onFailed("Add offer to DHT failed.",
|
||||
new Exception("Add offer to DHT failed. Reason: " + future.failedReason()));
|
||||
log.error("Add offer to DHT failed. Reason: " + future.failedReason());
|
||||
});
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -229,7 +230,8 @@ public class MessageFacade implements MessageBroker {
|
|||
futureRemove.addListener(new BaseFutureListener<BaseFuture>() {
|
||||
@Override
|
||||
public void operationComplete(BaseFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
// deactivate it for the moment until the port forwarding bug is fixed
|
||||
// if (future.isSuccess()) {
|
||||
Platform.runLater(() -> {
|
||||
offerBookListeners.stream().forEach(offerBookListener -> {
|
||||
try {
|
||||
|
@ -247,11 +249,11 @@ public class MessageFacade implements MessageBroker {
|
|||
});
|
||||
writeInvalidationTimestampToDHT(locationKey);
|
||||
});
|
||||
}
|
||||
/* }
|
||||
else {
|
||||
log.error("Remove offer from DHT failed. Cause: future.isSuccess() = false, locationKey: " +
|
||||
locationKey + ", Reason: " + future.failedReason());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -57,9 +57,9 @@ public class SeedNodeAddress {
|
|||
public enum StaticSeedNodeAddresses {
|
||||
// Manfreds server: "188.226.179.109"
|
||||
// Steves server: "128.199.251.106"
|
||||
DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000)/*,
|
||||
DIGITAL_OCEAN2("digitalocean2.bitsquare.io", "128.199.251.106", 5000),
|
||||
LOCALHOST("localhost", "127.0.0.1", 5000)*/;
|
||||
DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000),
|
||||
DIGITAL_OCEAN2("digitalocean2.bitsquare.io", "128.199.251.106", 5000);
|
||||
//LOCALHOST("localhost", "127.0.0.1", 5000);
|
||||
|
||||
private final String id;
|
||||
private final String ip;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue