mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20: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.
|
// Use buffered go channel to pass snowflakes onwards to the SOCKS handler.
|
||||||
p.snowflakeChan = make(chan Snowflake, max)
|
p.snowflakeChan = make(chan Snowflake, max)
|
||||||
p.activePeers = list.New()
|
p.activePeers = list.New()
|
||||||
p.melt = make(chan struct{}, 1)
|
p.melt = make(chan struct{})
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ func (p *Peers) purgeClosedPeers() {
|
||||||
// Close all Peers contained here.
|
// Close all Peers contained here.
|
||||||
func (p *Peers) End() {
|
func (p *Peers) End() {
|
||||||
close(p.snowflakeChan)
|
close(p.snowflakeChan)
|
||||||
p.melt <- struct{}{}
|
close(p.melt)
|
||||||
cnt := p.Count()
|
cnt := p.Count()
|
||||||
for e := p.activePeers.Front(); e != nil; {
|
for e := p.activePeers.Front(); e != nil; {
|
||||||
next := e.Next()
|
next := e.Next()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue