Improve logging of unicast gossip errors
This commit is contained in:
1 parent
c58cc449c0
commit
b472da18f0
2 files changed
+9
-8
No files matched your search
+4
-2
@@ -44,8 +44,10 @@ func (g *allocate) Try(alloc *Allocator) bool {
|
||||
// out of space
|
||||
donors := alloc.ring.ChoosePeersToAskForSpace(g.r.Start, g.r.End)
|
||||
for _, donor := range donors {
|
||||
alloc.debugln("Decided to ask peer", donor, "for space in range", g.r)
|
||||
if err := alloc.sendSpaceRequest(donor, g.r); err == nil {
|
||||
if err := alloc.sendSpaceRequest(donor, g.r); err != nil {
|
||||
alloc.debugln("Problem asking peer", donor, "for space:", err)
|
||||
} else {
|
||||
alloc.debugln("Decided to ask peer", donor, "for space in range", g.r)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +59,11 @@ func (c *GossipChannel) deliverUnicast(srcName PeerName, origPayload []byte, dec
|
||||
return err
|
||||
}
|
||||
if c.ourself.Name != destName {
|
||||
c.relayUnicast(destName, origPayload)
|
||||
// ignore errors in passing on data; a problem between us and destination
|
||||
// is not enough reason to break the connection from the source
|
||||
if err := c.relayUnicast(destName, origPayload); err != nil {
|
||||
// just log errors from relayUnicast; a problem between us and destination
|
||||
// is not enough reason to break the connection from the source
|
||||
c.log(err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
var payload []byte
|
||||
@@ -172,9 +174,6 @@ func (c *GossipChannel) relayUnicast(dstPeerName PeerName, buf []byte) (err erro
|
||||
} else {
|
||||
conn.(ProtocolSender).SendProtocolMsg(ProtocolMsg{ProtocolGossipUnicast, buf})
|
||||
}
|
||||
if err != nil {
|
||||
c.log(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user