Skip to content

Commit

Permalink
2024-08-07 14:01:24
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Aug 7, 2024
1 parent ff82585 commit 2b09fc3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion protocol/czar/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func (c *Client) Run() {
var (
err error
mux *Mux
rtt = 0
sid = 0
srv net.Conn
)
Expand All @@ -160,12 +161,15 @@ func (c *Client) Run() {
case srv == nil:
log.Println("czar:", err)
select {
case <-time.After(time.Minute):
case <-time.After(time.Second * time.Duration(math.Pow(2, float64(rtt)))):
// A slow start reconnection algorithm.
rtt = min(rtt+1, 5)
case <-c.Cancel:
sid = 2
}
case err == nil:
mux = NewMuxClient(srv)
rtt = 0
sid = 1
}
case 1:
Expand Down

0 comments on commit 2b09fc3

Please sign in to comment.