diff --git a/cmd/syncthing/connections.go b/cmd/syncthing/connections.go index c1021997..2c47b3b3 100644 --- a/cmd/syncthing/connections.go +++ b/cmd/syncthing/connections.go @@ -143,7 +143,7 @@ next: s.mut.RLock() ct, ok := s.connType[remoteID] s.mut.RUnlock() - if ok && !ct.IsDirect() && c.ConnType.IsDirect() { + if ok && !ct.IsDirect() && c.Type.IsDirect() { if debugNet { l.Debugln("Switching connections", remoteID) } @@ -194,7 +194,7 @@ next: rd = &limitedReader{c.Conn, readRateLimit} } - name := fmt.Sprintf("%s-%s (%s)", c.Conn.LocalAddr(), c.Conn.RemoteAddr(), c.ConnType) + name := fmt.Sprintf("%s-%s (%s)", c.Conn.LocalAddr(), c.Conn.RemoteAddr(), c.Type) protoConn := protocol.NewConnection(remoteID, rd, wr, s.model, name, deviceCfg.Compression) l.Infof("Established secure connection to %s at %s", remoteID, name) @@ -205,10 +205,10 @@ next: s.model.AddConnection(model.Connection{ c.Conn, protoConn, - c.ConnType, + c.Type, }) s.mut.Lock() - s.connType[remoteID] = c.ConnType + s.connType[remoteID] = c.Type s.mut.Unlock() continue next } @@ -219,11 +219,9 @@ next: "device": remoteID.String(), "address": c.Conn.RemoteAddr().String(), }) - l.Infof("Connection from %s (%s) with unknown device ID %s", c.Conn.RemoteAddr(), c.ConnType, remoteID) - } else { - l.Infof("Connection from %s (%s) with ignored device ID %s", c.Conn.RemoteAddr(), c.ConnType, remoteID) } + l.Infof("Connection from %s (%s) with ignored device ID %s", c.Conn.RemoteAddr(), c.Type, remoteID) c.Conn.Close() } } diff --git a/lib/model/connection.go b/lib/model/connection.go index d7c2bda0..78e9f0f2 100644 --- a/lib/model/connection.go +++ b/lib/model/connection.go @@ -14,8 +14,8 @@ import ( ) type IntermediateConnection struct { - Conn *tls.Conn - ConnType ConnectionType + *tls.Conn + Type ConnectionType } type Connection struct {