Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tapdance/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/hex"
"errors"
"fmt"
"math"
"os"
"strconv"
"time"
Expand Down Expand Up @@ -171,8 +172,9 @@ func WriteTlsLog(clientRandom, masterSecret []byte) error {

// How much time to sleep on trying to connect to decoys to prevent overwhelming them
func sleepBeforeConnect(attempt int) (waitTime <-chan time.Time) {
if attempt >= 6 { // return nil for first 6 attempts
waitTime = time.After(time.Second * 1)
if attempt >= 1 {
ms := math.Min(25*math.Pow(2, float64(attempt)), 15000)
waitTime = time.After(time.Duration(int(ms)) * time.Millisecond)
}
return
}
Expand Down