mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-01 03:06:14 -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");
|
persistence.write(this, "lastSuccessfulBootstrap", "default");
|
||||||
bootstrapCounter = 0;
|
bootstrapCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
persistence.write(this, "bootstrapCounter", bootstrapCounter);
|
persistence.write(this, "bootstrapCounter", bootstrapCounter);
|
||||||
|
|
||||||
|
|
||||||
String lastSuccessfulBootstrap = (String) persistence.read(this, "lastSuccessfulBootstrap");
|
String lastSuccessfulBootstrap = (String) persistence.read(this, "lastSuccessfulBootstrap");
|
||||||
if (lastSuccessfulBootstrap == null)
|
if (lastSuccessfulBootstrap == null)
|
||||||
lastSuccessfulBootstrap = "default";
|
lastSuccessfulBootstrap = "default";
|
||||||
|
|
||||||
log.debug("lastSuccessfulBootstrap = " + lastSuccessfulBootstrap);
|
log.debug("lastSuccessfulBootstrap = " + lastSuccessfulBootstrap);
|
||||||
FutureDiscover futureDiscover;
|
FutureDiscover futureDiscover;
|
||||||
|
|
||||||
|
// just temporary while port forwarding is not working
|
||||||
switch (lastSuccessfulBootstrap) {
|
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":
|
case "relay":
|
||||||
futureDiscover = peerDHT.peer().discover().peerAddress(getBootstrapAddress()).start();
|
futureDiscover = peerDHT.peer().discover().peerAddress(getBootstrapAddress()).start();
|
||||||
PeerNAT peerNAT = new PeerBuilderNAT(peerDHT.peer()).start();
|
PeerNAT peerNAT = new PeerBuilderNAT(peerDHT.peer()).start();
|
||||||
|
@ -167,7 +180,7 @@ public class BootstrappedPeerFactory {
|
||||||
default:
|
default:
|
||||||
discover(peerDHT);
|
discover(peerDHT);
|
||||||
break;
|
break;
|
||||||
}
|
}*/
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
setState("Cannot create peer with port: " + port + ". Exeption: " + e, false);
|
setState("Cannot create peer with port: " + port + ". Exeption: " + e, false);
|
||||||
settableFuture.setException(e);
|
settableFuture.setException(e);
|
||||||
|
@ -192,7 +205,13 @@ public class BootstrappedPeerFactory {
|
||||||
log.warn("Discover has failed. Reason: " + futureDiscover.failedReason());
|
log.warn("Discover has failed. Reason: " + futureDiscover.failedReason());
|
||||||
setState("We are probably behind a NAT and not reachable to other peers. " +
|
setState("We are probably behind a NAT and not reachable to other peers. " +
|
||||||
"We try port forwarding as next step.");
|
"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>() {
|
futurePut.addListener(new BaseFutureListener<BaseFuture>() {
|
||||||
@Override
|
@Override
|
||||||
public void operationComplete(BaseFuture future) throws Exception {
|
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(() -> {
|
Platform.runLater(() -> {
|
||||||
addOfferListener.onComplete();
|
addOfferListener.onComplete();
|
||||||
offerBookListeners.stream().forEach(listener -> {
|
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 +
|
log.trace("Add offer to DHT was successful. Added data: [locationKey: " + locationKey +
|
||||||
", value: " + offerData + "]");
|
", value: " + offerData + "]");
|
||||||
});
|
});
|
||||||
}
|
/* }
|
||||||
else {
|
else {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
addOfferListener.onFailed("Add offer to DHT failed.",
|
addOfferListener.onFailed("Add offer to DHT failed.",
|
||||||
new Exception("Add offer to DHT failed. Reason: " + future.failedReason()));
|
new Exception("Add offer to DHT failed. Reason: " + future.failedReason()));
|
||||||
log.error("Add offer to DHT failed. Reason: " + future.failedReason());
|
log.error("Add offer to DHT failed. Reason: " + future.failedReason());
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -229,7 +230,8 @@ public class MessageFacade implements MessageBroker {
|
||||||
futureRemove.addListener(new BaseFutureListener<BaseFuture>() {
|
futureRemove.addListener(new BaseFutureListener<BaseFuture>() {
|
||||||
@Override
|
@Override
|
||||||
public void operationComplete(BaseFuture future) throws Exception {
|
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(() -> {
|
Platform.runLater(() -> {
|
||||||
offerBookListeners.stream().forEach(offerBookListener -> {
|
offerBookListeners.stream().forEach(offerBookListener -> {
|
||||||
try {
|
try {
|
||||||
|
@ -247,11 +249,11 @@ public class MessageFacade implements MessageBroker {
|
||||||
});
|
});
|
||||||
writeInvalidationTimestampToDHT(locationKey);
|
writeInvalidationTimestampToDHT(locationKey);
|
||||||
});
|
});
|
||||||
}
|
/* }
|
||||||
else {
|
else {
|
||||||
log.error("Remove offer from DHT failed. Cause: future.isSuccess() = false, locationKey: " +
|
log.error("Remove offer from DHT failed. Cause: future.isSuccess() = false, locationKey: " +
|
||||||
locationKey + ", Reason: " + future.failedReason());
|
locationKey + ", Reason: " + future.failedReason());
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -57,9 +57,9 @@ public class SeedNodeAddress {
|
||||||
public enum StaticSeedNodeAddresses {
|
public enum StaticSeedNodeAddresses {
|
||||||
// Manfreds server: "188.226.179.109"
|
// Manfreds server: "188.226.179.109"
|
||||||
// Steves server: "128.199.251.106"
|
// Steves server: "128.199.251.106"
|
||||||
DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000)/*,
|
DIGITAL_OCEAN1("digitalocean1.bitsquare.io", "188.226.179.109", 5000),
|
||||||
DIGITAL_OCEAN2("digitalocean2.bitsquare.io", "128.199.251.106", 5000),
|
DIGITAL_OCEAN2("digitalocean2.bitsquare.io", "128.199.251.106", 5000);
|
||||||
LOCALHOST("localhost", "127.0.0.1", 5000)*/;
|
//LOCALHOST("localhost", "127.0.0.1", 5000);
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String ip;
|
private final String ip;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue