Skip to content

Commit 9b62ee5

Browse files
committed
net: fix connection pacing
1 parent 22d75b1 commit 9b62ee5

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

net_http.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func DefaultClientStrategySettings() *ClientStrategySettings {
6161

6262
HelloRetryTimeout: 5 * time.Second,
6363

64-
MinNextConnectDelay: 25 * time.Millisecond,
65-
MaxNextConnectDelay: 100 * time.Millisecond,
64+
MinNextConnectDelay: 100 * time.Millisecond,
65+
MaxNextConnectDelay: 1000 * time.Millisecond,
6666

6767
ConnectSettings: *DefaultConnectSettings(),
6868
}
@@ -323,10 +323,10 @@ func (self *ClientStrategy) NextConnectTime() time.Time {
323323
self.settings.MaxNextConnectDelay-self.settings.MinNextConnectDelay,
324324
)))
325325
nextConnectTime := self.nextConnectTime.Add(connectDelay)
326-
self.nextConnectTime = nextConnectTime
327-
if nextConnectTime.After(now) {
328-
return nextConnectTime
326+
if nextConnectTime.Before(now) {
327+
nextConnectTime = now
329328
}
329+
self.nextConnectTime = nextConnectTime
330330
return now
331331
}
332332

0 commit comments

Comments
 (0)