Polish connection/sync status and error messages

Relates to #320
This commit is contained in:
Chris Beams 2014-12-11 18:09:27 +01:00
parent 04d22e0380
commit beb4645118
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73
3 changed files with 24 additions and 25 deletions

View file

@ -258,7 +258,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
bootstrapStateLabel.setId("splash-error-state-msg"); bootstrapStateLabel.setId("splash-error-state-msg");
bootstrapIndicator.setVisible(false); bootstrapIndicator.setVisible(false);
Popups.openErrorPopup("Error", "Connection to P2P network failed. \n\nReason: " + Popups.openErrorPopup("Error", "Connecting to the Bitsquare network failed. \n\nReason: " +
model.bootstrapErrorMsg.get()); model.bootstrapErrorMsg.get());
} }
}); });

View file

@ -150,12 +150,12 @@ class MainViewModel implements ViewModel {
newValue == BootstrapState.RELAY_FAILED) { newValue == BootstrapState.RELAY_FAILED) {
bootstrapErrorMsg.set(newValue.getMessage()); bootstrapErrorMsg.set(newValue.getMessage());
bootstrapStateText.set("Connection to P2P network failed."); bootstrapStateText.set("Connecting to the Bitsquare network failed.");
bootstrapProgress.set(0); bootstrapProgress.set(0);
bootstrapFailed.set(true); bootstrapFailed.set(true);
} }
else { else {
bootstrapStateText.set("Connecting to P2P network: " + newValue.getMessage()); bootstrapStateText.set("Connecting to the Bitsquare network: " + newValue.getMessage());
} }
} }
); );
@ -196,10 +196,11 @@ class MainViewModel implements ViewModel {
bitcoinNetworkTimeout = Utilities.setTimeout(20000, animationTimer -> { bitcoinNetworkTimeout = Utilities.setTimeout(20000, animationTimer -> {
Platform.runLater(() -> { Platform.runLater(() -> {
networkSyncProgress.set(0); networkSyncProgress.set(0);
blockchainSyncState.set("Connection to bitcoin network failed."); blockchainSyncState.set("Connecting to the bitcoin network failed.");
Popups.openErrorPopup("Connection to bitcoin network failed", Popups.openErrorPopup("Connecting to the bitcoin network failed",
"Please check your network connection.\n\n" + "Please check your network connection.\n\n" +
"You need to allow outgoing TCP connections to port 18333 for the bitcoin testnet."); "You must allow outgoing TCP connections to port 18333 for the bitcoin testnet.\n\n" +
"See https://github.com/bitsquare/bitsquare/wiki for instructions.");
}); });
return null; return null;
}); });
@ -300,11 +301,11 @@ class MainViewModel implements ViewModel {
private void setNetworkSyncProgress(double value) { private void setNetworkSyncProgress(double value) {
blockchainSyncProgress.set(value); blockchainSyncProgress.set(value);
if (value >= 1) if (value >= 1)
blockchainSyncState.set("Synchronization completed."); blockchainSyncState.set("Blockchain synchronization complete.");
else if (value > 0.0) else if (value > 0.0)
blockchainSyncState.set("Synchronizing blockchain: " + formatter.formatToPercent(value)); blockchainSyncState.set("Synchronizing blockchain: " + formatter.formatToPercent(value));
else else
blockchainSyncState.set("Connecting to bitcoin network..."); blockchainSyncState.set("Connecting to the bitcoin network...");
blockchainSyncIndicatorVisible.set(value < 1); blockchainSyncIndicatorVisible.set(value < 1);
} }

View file

@ -185,20 +185,20 @@ class BootstrappedPeerBuilder {
// We need to discover our external address and test if we are reachable for other nodes // We need to discover our external address and test if we are reachable for other nodes
// We know our internal address from a discovery of our local network interfaces // We know our internal address from a discovery of our local network interfaces
// We start a discover process with our bootstrap node. // We start a discover process with our bootstrap node.
// There are 4 cases: // There are 4 cases:
// 1. If we are not behind a NAT we get reported back the same address as our internal. // 1. If we are not behind a NAT we get reported back the same address as our internal.
// 2. If we are behind a NAT and manual port forwarding is setup we get reported our external address from the // 2. If we are behind a NAT and manual port forwarding is setup we get reported our external address from the
// bootstrap node and the bootstrap node could ping us so we know we are reachable. // bootstrap node and the bootstrap node could ping us so we know we are reachable.
// 3. If we are behind a NAT and the ping probes fails we need to setup port forwarding with UPnP or NAT-PMP. // 3. If we are behind a NAT and the ping probes fails we need to setup port forwarding with UPnP or NAT-PMP.
// If that is successfully setup we need to try again a discover so we find out our external address and have // If that is successfully setup we need to try again a discover so we find out our external address and have
// tested successfully our reachability (the additional discover is done internally from startSetupPortforwarding) // tested successfully our reachability (the additional discover is done internally from startSetupPortforwarding)
// 4. If the port forwarding failed we can try as last resort to open a permanent TCP connection to the // 4. If the port forwarding failed we can try as last resort to open a permanent TCP connection to the
// bootstrap node and use that peer as relay (currently not supported as its too unstable) // bootstrap node and use that peer as relay (currently not supported as its too unstable)
private void discoverExternalAddress() { private void discoverExternalAddress() {
FutureDiscover futureDiscover = peer.discover().peerAddress(getBootstrapAddress()).start(); FutureDiscover futureDiscover = peer.discover().peerAddress(getBootstrapAddress()).start();
setState(BootstrapState.DISCOVERY_STARTED, "We are starting discovery against a bootstrap node."); setState(BootstrapState.DISCOVERY_STARTED, "Starting discovery...");
PeerNAT peerNAT = new PeerBuilderNAT(peer).start(); PeerNAT peerNAT = new PeerBuilderNAT(peer).start();
FutureNAT futureNAT = peerNAT.startSetupPortforwarding(futureDiscover); FutureNAT futureNAT = peerNAT.startSetupPortforwarding(futureDiscover);
futureNAT.addListener(new BaseFutureListener<BaseFuture>() { futureNAT.addListener(new BaseFutureListener<BaseFuture>() {
@ -208,31 +208,29 @@ class BootstrappedPeerBuilder {
if (futureDiscover.isSuccess()) { if (futureDiscover.isSuccess()) {
if (useManualPortForwarding) { if (useManualPortForwarding) {
setState(BootstrapState.DISCOVERY_MANUAL_PORT_FORWARDING_SUCCEEDED, setState(BootstrapState.DISCOVERY_MANUAL_PORT_FORWARDING_SUCCEEDED,
"We use manual port forwarding and are visible to other peers."); "Now visible to the Bitsquare network (with manual port forwarding).");
bootstrap(); bootstrap();
} }
else { else {
setState(BootstrapState.DISCOVERY_DIRECT_SUCCEEDED, setState(BootstrapState.DISCOVERY_DIRECT_SUCCEEDED, "Now visible to the Bitsquare network.");
"We are not behind a NAT and visible to other peers.");
bootstrap(); bootstrap();
} }
} }
else { else {
setState(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_STARTED, setState(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_STARTED,
"We are probably behind a NAT and not reachable to other peers. " + "Configuring automatic port forwarding");
"We try to setup automatic port forwarding.");
if (futureNAT.isSuccess()) { if (futureNAT.isSuccess()) {
setState(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_SUCCEEDED, setState(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_SUCCEEDED,
"Discover with automatic port forwarding was successful."); "Now visible to the Bitsquare network (with automatic port forwarding).");
bootstrap(); bootstrap();
} }
else { else {
handleError(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_FAILED, "Automatic port forwarding " + handleError(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_FAILED,
"failed. " + "Automatic port forwarding failed.\n\n" +
"\n\nCheck if UPnP is enabled on your router. " + "Check whether UPnP (Universal Plug and Play) is enabled on your router.\n\n" +
"\nIf it is enabled and it still does not work you can try also to setup manual port " + "If UPnP is enabled and you still cannot connect, you will need to set up " +
"forwarding. " + "manual port forwarding.\n\n" +
"\n\nYou find on our Github Wiki help how to setup manual port forwarding."); "See https://github.com/bitsquare/bitsquare/wiki for instructions.");
// For the moment we don't support relay mode as it has too much problems // 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. " + /* setState(BootstrapState.AUTO_PORT_FORWARDING_NOT_SUCCEEDED, "Port forwarding has failed. " +