From 403583cfbbddfc726cb9dc5658405f67e55ad795 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sun, 13 Dec 2015 12:20:25 +0000 Subject: [PATCH] More debug to reconnect loop --- lib/connections/connections.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/connections/connections.go b/lib/connections/connections.go index 740d48689..8371affcc 100644 --- a/lib/connections/connections.go +++ b/lib/connections/connections.go @@ -260,12 +260,15 @@ next: func (s *connectionSvc) connect() { delay := time.Second for { + l.Debugln("Reconnect loop") nextDevice: for deviceID, deviceCfg := range s.cfg.Devices() { if deviceID == s.myID { continue } + l.Debugln("Reconnect loop for", deviceID) + if s.model.IsPaused(deviceID) { continue } @@ -277,6 +280,7 @@ func (s *connectionSvc) connect() { relaysEnabled := s.relaysEnabled s.mut.RUnlock() if connected && ok && ct.IsDirect() { + l.Debugln("Already connected to", deviceID, "via", ct.String()) continue } @@ -284,6 +288,7 @@ func (s *connectionSvc) connect() { for _, addr := range addrs { if conn := s.connectDirect(deviceID, addr); conn != nil { + l.Debugln("Connectin to", deviceID, "via", addr, "succeeded") if connected { s.model.Close(deviceID, fmt.Errorf("switching connections")) } @@ -292,6 +297,7 @@ func (s *connectionSvc) connect() { } continue nextDevice } + l.Debugln("Connectin to", deviceID, "via", addr, "failed") } // Only connect via relays if not already connected @@ -300,6 +306,7 @@ func (s *connectionSvc) connect() { // wait up to RelayReconnectIntervalM to connect again. // Also, do not try relays if we are explicitly told not to. if connected || len(relays) == 0 || !relaysEnabled { + l.Debugln("Not connecting via relay", connected, len(relays) == 0, !relaysEnabled) continue nextDevice } @@ -315,11 +322,13 @@ func (s *connectionSvc) connect() { for _, addr := range relays { if conn := s.connectViaRelay(deviceID, addr); conn != nil { + l.Debugln("Connectin to", deviceID, "via", addr, "succeeded") s.conns <- model.IntermediateConnection{ conn, model.ConnectionTypeRelayDial, } continue nextDevice } + l.Debugln("Connectin to", deviceID, "via", addr, "failed") } }