mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Close the melt channel, don't just send once on it.
Closing the channel makes it always immediately selectable.
This commit is contained in:
parent
febb4936f6
commit
f1ab65b1c0
1 changed files with 2 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue