[tor-commits] [snowflake/master] Close the melt channel, don't just send once on it.
dcf at torproject.org
dcf at torproject.org
Tue Jan 28 03:58:52 UTC 2020
commit f1ab65b1c050ee603454f3d9836753512863e21a
Author: David Fifield <david at bamsoftware.com>
Date: Tue Dec 24 19:22:48 2019 -0700
Close the melt channel, don't just send once on it.
Closing the channel makes it always immediately selectable.
---
client/lib/peers.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/client/lib/peers.go b/client/lib/peers.go
index 12213e1..d385971 100644
--- a/client/lib/peers.go
+++ b/client/lib/peers.go
@@ -35,7 +35,7 @@ func NewPeers(max int) *Peers {
// Use buffered go channel to pass snowflakes onwards to the SOCKS handler.
p.snowflakeChan = make(chan Snowflake, max)
p.activePeers = list.New()
- p.melt = make(chan struct{}, 1)
+ p.melt = make(chan struct{})
return p
}
@@ -110,7 +110,7 @@ func (p *Peers) purgeClosedPeers() {
// Close all Peers contained here.
func (p *Peers) End() {
close(p.snowflakeChan)
- p.melt <- struct{}{}
+ close(p.melt)
cnt := p.Count()
for e := p.activePeers.Front(); e != nil; {
next := e.Next()
More information about the tor-commits
mailing list