From b1fd1334b4c82d8230914b31962491f98fd7caab Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 14 Apr 2015 22:14:29 +0100 Subject: [PATCH] always include the remote address in connection log entries in addition to the peer name This is handy for debugging, especially in situations when there are multiple connections in flight to the same peer. --- router/connection.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/router/connection.go b/router/connection.go index 2d10f692..240abddd 100644 --- a/router/connection.go +++ b/router/connection.go @@ -82,7 +82,7 @@ func (conn *RemoteConnection) BreakTie(Connection) ConnectionTieBreak { return T func (conn *RemoteConnection) Shutdown(error) {} func (conn *RemoteConnection) Log(args ...interface{}) { - log.Println(append(append([]interface{}{}, fmt.Sprintf("->[%s]:", conn.remote.FullName())), args...)...) + log.Println(append(append([]interface{}{}, fmt.Sprintf("->[%s|%s]:", conn.remoteTCPAddr, conn.remote.FullName())), args...)...) } func (conn *RemoteConnection) String() string { @@ -296,7 +296,7 @@ func (conn *LocalConnection) run(actionChan <-chan ConnectionAction, finished ch if err = conn.handshake(enc, dec, acceptNewPeer); err != nil { return } - log.Printf("->[%s] completed handshake with %s\n", conn.remoteTCPAddr, conn.remote.FullName()) + conn.Log("completed handshake") if err = conn.initHeartbeats(); err != nil { // [1] return