Split Client#onlineInit method up into performHandshake and initReceiver

This commit is contained in:
2020-02-12 07:53:24 +01:00
parent c697b099ee
commit 17eeed0bfb
3 changed files with 42 additions and 11 deletions

View File

@ -62,7 +62,7 @@ public class Startup {
if (args.length > 0) config.load(args);
// Check if all mandatory configuration values have been initialized
if (!config.isInitialized()) throw new EnvoyException("Server or port are not defined");
if (!config.isInitialized()) throw new EnvoyException("Configuration is not fully initialized");
} catch (Exception e) {
JOptionPane
.showMessageDialog(null, "Error loading configuration values:\n" + e.toString(), "Configuration error", JOptionPane.ERROR_MESSAGE);
@ -109,7 +109,8 @@ public class Startup {
try {
// Try entering online mode first
localDb.loadIdGenerator();
client.onlineInit(credentials, localDb, cache);
client.performHandshake(credentials, cache);
client.initReceiver(localDb, cache);
} catch (Exception e1) {
logger.warning("Could not connect to server. Trying offline mode...");
e1.printStackTrace();