Inline GossipSender.flush() and don't try to send nil
This commit is contained in:
1 parent
bd5353024f
commit
35b3a2d6a6
1 file changed
+8
-12
+8
-12
@@ -63,7 +63,14 @@ func (sender *GossipSender) run() {
|
|||||||
}
|
}
|
||||||
sender.send(pending)
|
sender.send(pending)
|
||||||
case ch := <-sender.flushch:
|
case ch := <-sender.flushch:
|
||||||
sender.flush()
|
// ensure anything pending is sent, then close the channel we were given
|
||||||
|
select {
|
||||||
|
case pending := <-sender.cell:
|
||||||
|
if pending != nil {
|
||||||
|
sender.send(pending)
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
}
|
||||||
close(ch)
|
close(ch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,14 +348,3 @@ func (router *Router) sendPendingGossip() {
|
|||||||
<-ch
|
<-ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sender *GossipSender) flush() {
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case pending := <-sender.cell:
|
|
||||||
sender.send(pending)
|
|
||||||
default:
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user