From beb46451185eed64210e9771f2f3f2c84406e92e Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Thu, 11 Dec 2014 18:09:27 +0100 Subject: [PATCH] Polish connection/sync status and error messages Relates to #320 --- .../java/io/bitsquare/gui/main/MainView.java | 2 +- .../io/bitsquare/gui/main/MainViewModel.java | 15 +++++---- .../msg/tomp2p/BootstrappedPeerBuilder.java | 32 +++++++++---------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/main/java/io/bitsquare/gui/main/MainView.java b/src/main/java/io/bitsquare/gui/main/MainView.java index 64df963462..7c7acc45b8 100644 --- a/src/main/java/io/bitsquare/gui/main/MainView.java +++ b/src/main/java/io/bitsquare/gui/main/MainView.java @@ -258,7 +258,7 @@ public class MainView extends InitializableView { bootstrapStateLabel.setId("splash-error-state-msg"); 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()); } }); diff --git a/src/main/java/io/bitsquare/gui/main/MainViewModel.java b/src/main/java/io/bitsquare/gui/main/MainViewModel.java index 74c4e007f8..eb4e63d5fe 100644 --- a/src/main/java/io/bitsquare/gui/main/MainViewModel.java +++ b/src/main/java/io/bitsquare/gui/main/MainViewModel.java @@ -150,12 +150,12 @@ class MainViewModel implements ViewModel { newValue == BootstrapState.RELAY_FAILED) { bootstrapErrorMsg.set(newValue.getMessage()); - bootstrapStateText.set("Connection to P2P network failed."); + bootstrapStateText.set("Connecting to the Bitsquare network failed."); bootstrapProgress.set(0); bootstrapFailed.set(true); } 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 -> { Platform.runLater(() -> { networkSyncProgress.set(0); - blockchainSyncState.set("Connection to bitcoin network failed."); - Popups.openErrorPopup("Connection to bitcoin network failed", + blockchainSyncState.set("Connecting to the bitcoin network failed."); + Popups.openErrorPopup("Connecting to the bitcoin network failed", "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; }); @@ -300,11 +301,11 @@ class MainViewModel implements ViewModel { private void setNetworkSyncProgress(double value) { blockchainSyncProgress.set(value); if (value >= 1) - blockchainSyncState.set("Synchronization completed."); + blockchainSyncState.set("Blockchain synchronization complete."); else if (value > 0.0) blockchainSyncState.set("Synchronizing blockchain: " + formatter.formatToPercent(value)); else - blockchainSyncState.set("Connecting to bitcoin network..."); + blockchainSyncState.set("Connecting to the bitcoin network..."); blockchainSyncIndicatorVisible.set(value < 1); } diff --git a/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerBuilder.java b/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerBuilder.java index d28be2c319..66006a7747 100644 --- a/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerBuilder.java +++ b/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerBuilder.java @@ -185,20 +185,20 @@ class BootstrappedPeerBuilder { // 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 start a discover process with our bootstrap node. + // We start a discover process with our bootstrap node. // There are 4 cases: // 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. // 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) - // 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) private void discoverExternalAddress() { 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(); FutureNAT futureNAT = peerNAT.startSetupPortforwarding(futureDiscover); futureNAT.addListener(new BaseFutureListener() { @@ -208,31 +208,29 @@ class BootstrappedPeerBuilder { if (futureDiscover.isSuccess()) { if (useManualPortForwarding) { 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(); } else { - setState(BootstrapState.DISCOVERY_DIRECT_SUCCEEDED, - "We are not behind a NAT and visible to other peers."); + setState(BootstrapState.DISCOVERY_DIRECT_SUCCEEDED, "Now visible to the Bitsquare network."); bootstrap(); } } else { setState(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_STARTED, - "We are probably behind a NAT and not reachable to other peers. " + - "We try to setup automatic port forwarding."); + "Configuring automatic port forwarding"); if (futureNAT.isSuccess()) { 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(); } else { - handleError(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_FAILED, "Automatic port forwarding " + - "failed. " + - "\n\nCheck if UPnP is enabled on your router. " + - "\nIf it is enabled and it still does not work you can try also to setup manual port " + - "forwarding. " + - "\n\nYou find on our Github Wiki help how to setup manual port forwarding."); + handleError(BootstrapState.DISCOVERY_AUTO_PORT_FORWARDING_FAILED, + "Automatic port forwarding failed.\n\n" + + "Check whether UPnP (Universal Plug and Play) is enabled on your router.\n\n" + + "If UPnP is enabled and you still cannot connect, you will need to set up " + + "manual port forwarding.\n\n" + + "See https://github.com/bitsquare/bitsquare/wiki for instructions."); // 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. " +