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:
1 parent
db198652a5
commit
0cbbe9bac3
8 files changed
+20
-20
No files matched your search
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user