rpcclient: Shutdown breaks reconnect sleep.

When a shutdown is requested, the sleep should not continue in
(*Client).wsReconnectHandler.  Instead, use a select with the shutdown
channel and a time.After.
This commit is contained in:
Jonathan Chappelow 2021-08-05 11:38:53 -07:00 committed by GitHub
parent 9f23126c9a
commit 02a58def2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -716,9 +716,13 @@ out:
if scaledDuration > time.Minute {
scaledDuration = time.Minute
}
log.Infof("Retrying connection to %s in "+
"%s", c.config.Host, scaledDuration)
time.Sleep(scaledDuration)
log.Infof("Retrying connection to %s in %s",
c.config.Host, scaledDuration)
select {
case <-c.shutdown:
break out
case <-time.After(scaledDuration):
}
continue reconnect
}