Log connection errors at INFO level (fixes #225)

This commit is contained in:
Jakob Borg 2014-05-16 19:10:16 +02:00
parent 78f0f2b131
commit 09d4b3f71e

View File

@ -571,20 +571,20 @@ next:
for conn := range conns { for conn := range conns {
certs := conn.ConnectionState().PeerCertificates certs := conn.ConnectionState().PeerCertificates
if cl := len(certs); cl != 1 { if cl := len(certs); cl != 1 {
l.Warnf("Got peer certificate list of length %d != 1; protocol error", cl) l.Infof("Got peer certificate list of length %d != 1 from %s; protocol error", cl, conn.RemoteAddr())
conn.Close() conn.Close()
continue continue
} }
remoteID := certID(certs[0].Raw) remoteID := certID(certs[0].Raw)
if remoteID == myID { if remoteID == myID {
l.Warnf("Connected to myself (%s) - should not happen", remoteID) l.Infof("Connected to myself (%s) - should not happen", remoteID)
conn.Close() conn.Close()
continue continue
} }
if m.ConnectedTo(remoteID) { if m.ConnectedTo(remoteID) {
l.Warnf("Connected to already connected node (%s)", remoteID) l.Infof("Connected to already connected node (%s)", remoteID)
conn.Close() conn.Close()
continue continue
} }
@ -600,6 +600,8 @@ next:
continue next continue next
} }
} }
l.Infof("Connection from %s with unknown node ID %s; ignoring", conn.RemoteAddr(), remoteID)
conn.Close() conn.Close()
} }
} }