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");
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());
}
});

View File

@ -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);
}

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 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<BaseFuture>() {
@ -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. " +