Skip to content
Snippets Groups Projects
Commit 3e8947bf authored by Cecylia Bocovich's avatar Cecylia Bocovich
Browse files

Avoid double delay in client from ReconnectTimeout

Run the snowflake collection ReconnectTimeout timer in parallel to the
negotiation with the broker. This way, if the broker takes a long time
to respond the client doesn't have to wait the full timeout to respond.
parent effc6675
No related branches found
No related tags found
No related merge requests found
......@@ -136,13 +136,13 @@ func Handler(socks net.Conn, tongue Tongue) error {
// transfer to the Tor SOCKS handler when needed.
func connectLoop(snowflakes SnowflakeCollector) {
for {
timer := time.After(ReconnectTimeout)
_, err := snowflakes.Collect()
if err != nil {
log.Printf("WebRTC: %v Retrying in %v...",
err, ReconnectTimeout)
log.Printf("WebRTC: %v Retrying...", err)
}
select {
case <-time.After(ReconnectTimeout):
case <-timer:
continue
case <-snowflakes.Melted():
log.Println("ConnectLoop: stopped.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment