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
Pipeline #1850 failed with stage
in 5 minutes and 28 seconds
......@@ -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:
case <-snowflakes.Melted():
log.Println("ConnectLoop: stopped.")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment