ensure closing stale remotes from the client side

This commit is contained in:
Serene H 2016-08-01 12:17:28 -07:00
parent ea2e052a7d
commit ac9d49b872
2 changed files with 70 additions and 46 deletions

View file

@ -20,6 +20,7 @@ import (
const (
ReconnectTimeout = 10
DefaultSnowflakeCapacity = 1
SnowflakeTimeout = 30
)
// When a connection handler starts, +1 is written to this channel; when it
@ -81,7 +82,7 @@ func handler(socks SocksConnector, snowflakes SnowflakeCollector) error {
return errors.New("handler: Received invalid Snowflake")
}
defer socks.Close()
defer snowflake.Reset()
defer snowflake.Close()
log.Println("---- Handler: snowflake assigned ----")
err := socks.Grant(&net.TCPAddr{IP: net.IPv4zero, Port: 0})
if err != nil {