[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [snowflake/master] Close the melt channel, don't just send once on it.
commit f1ab65b1c050ee603454f3d9836753512863e21a
Author: David Fifield <david@xxxxxxxxxxxxxxx>
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()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits