From da5c18b2f99a9a93506f30e22ab943e91c831b55 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sun, 6 Sep 2015 20:03:43 +0900 Subject: [PATCH] Be patient whilst connecting On startup we make several connections simultaneously. Socket maintenance code checks if we're not connected, and if not switches to a connected interface if auto_connect. Unfortunately this meant that we frequently didn't reconnect to the prior good server on startup, because some other connection would happen first and this code would decide to switch to it. Instead, only switch if a connection attempt is not in progress. If that times out at the O/S level the switch will happen. --- lib/network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/network.py b/lib/network.py index bb2894613..93d832e9e 100644 --- a/lib/network.py +++ b/lib/network.py @@ -642,7 +642,8 @@ class Network(util.DaemonThread): # main interface if not self.is_connected(): if self.auto_connect: - self.switch_to_random_interface() + if not self.is_connecting(): + self.switch_to_random_interface() else: if self.default_server in self.disconnected_servers: if now - self.server_retry_time > SERVER_RETRY_INTERVAL: