summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-06-05 14:58:13 -0500
committercitrons <citrons@mondecitronne.com>2025-06-07 16:02:18 -0500
commit768fc1782ad4aefeb6ace455b3a74b42832e17e3 (patch)
treef412a2b0807bf6aad8417e49ff6fb33bdcfdb29d /client
parent4e46b6cad58b6a4f0e9235a267c817e239b42334 (diff)
randomize reconnect time
Diffstat (limited to 'client')
-rw-r--r--client/client/client.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/client/client/client.go b/client/client/client.go
index 0b24175..2d47ded 100644
--- a/client/client/client.go
+++ b/client/client/client.go
@@ -5,6 +5,7 @@ import (
"net"
"time"
"bufio"
+ "math/rand"
)
type MessageHandler interface {
@@ -56,7 +57,7 @@ func (c *Client) RunClient() {
continue
}
defer conn.Close()
- sleep = time.Second
+ sleep = time.Second / time.Duration(2 + rand.Int() % 4)
recv, recvErr := proto.ReadLines(bufio.NewReader(conn))
send := make(chan proto.Line, 1)