File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ func (proxy *Proxy) StartProxy() {
324324 if liveServers == 0 {
325325 delay = proxy .certRefreshDelayAfterFailure
326326 }
327- clocksmith . Sleep (delay )
327+ sleepIncludeInertia (delay )
328328 liveServers , _ = proxy .serversInfo .refresh (proxy )
329329 if liveServers > 0 {
330330 proxy .certIgnoreTimestamp = false
@@ -335,6 +335,16 @@ func (proxy *Proxy) StartProxy() {
335335 }
336336}
337337
338+ func sleepIncludeInertia (duration time.Duration ) {
339+ // When restoring from hibernation, the NIC (Network Interface Card) needs time to get ready.
340+ nicInitDelay := time .Minute
341+ if duration > nicInitDelay {
342+ clocksmith .Sleep (duration - nicInitDelay )
343+ duration = nicInitDelay
344+ }
345+ time .Sleep (duration ) // Frozen during this?! Lower probability.
346+ }
347+
338348func (proxy * Proxy ) updateRegisteredServers () error {
339349 for _ , source := range proxy .sources {
340350 registeredServers , err := source .Parse ()
You can’t perform that action at this time.
0 commit comments