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.
This commit is contained in:
Matthias Radestock committed 2015-04-14 22:14:29 +01:00
1 parent 74b3bf8299
commit b1fd1334b4
1 file changed
+2 -2
+2 -2
View File
@@ -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