make Peer.String() return the common case

When we want a string representation of a Peer, we nearly always just
want the full name. So make String() return that and introduce Info()
to return expanded info.
This commit is contained in:
Matthias Radestock committed 2015-05-10 23:58:23 +01:00
1 parent db198652a5
commit 0cbbe9bac3
8 files changed
+20 -20

No files matched your search

+2 -2
View File
@@ -38,7 +38,7 @@ func (peer *LocalPeer) Relay(srcPeer, dstPeer *Peer, df bool, frame []byte, dec
if !found {
// Not necessarily an error as there could be a race with the
// dst disappearing whilst the frame is in flight
log.Println("Received packet for unknown destination:", dstPeer.FullName())
log.Println("Received packet for unknown destination:", dstPeer)
return nil
}
conn, found := peer.ConnectionTo(relayPeerName)
@@ -162,7 +162,7 @@ func (peer *LocalPeer) handleAddConnection(conn Connection) error {
log.Fatal("Attempt made to add connection to peer with unknown remote peer")
}
toName := conn.Remote().Name
dupErr := fmt.Errorf("Multiple connections to %s added to %s", conn.Remote().FullName(), peer.FullName())
dupErr := fmt.Errorf("Multiple connections to %s added to %s", conn.Remote(), peer)
// deliberately non symmetrical
if dupConn, found := peer.connections[toName]; found {
if dupConn == conn {