mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 21:50:09 +00:00
TUN-2940: Added delay parameter to stdin reconnect command.
This commit is contained in:
21
origin/external_control.go
Normal file
21
origin/external_control.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package origin
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type ReconnectSignal struct {
|
||||
// wait this many seconds before re-establish the connection
|
||||
Delay time.Duration
|
||||
}
|
||||
|
||||
// Error allows us to use ReconnectSignal as a special error to force connection abort
|
||||
func (r *ReconnectSignal) Error() string {
|
||||
return "reconnect signal"
|
||||
}
|
||||
|
||||
func (r *ReconnectSignal) DelayBeforeReconnect() {
|
||||
if r.Delay > 0 {
|
||||
time.Sleep(r.Delay)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user