diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-01-12 18:41:37 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-01-12 21:34:00 +0100 |
| commit | 724b305dcb57ccbaa13b476d08a03c32ccd1b4ed (patch) | |
| tree | 8d9f27770b8d70fa728c0a472fe6e0289171184e /internal/failover/failover.go | |
| parent | 07b3361d998c9b653f39d382da04914abcb00296 (diff) | |
Failover: Return early by waiting for a single pong
Diffstat (limited to 'internal/failover/failover.go')
| -rw-r--r-- | internal/failover/failover.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/internal/failover/failover.go b/internal/failover/failover.go index 31fb2b0..1c4c32e 100644 --- a/internal/failover/failover.go +++ b/internal/failover/failover.go @@ -10,9 +10,6 @@ const ( // Send a ping every 2 seconds to the gateway pInterval time.Duration = 2 * time.Second - // pAlive is how many pings we need to have sent to check if the connection is alive - pAlive int = 3 - // pDropped is how many pings we need to have sent to check if the connection is dropped pDropped int = 5 ) @@ -20,6 +17,6 @@ const ( // New creates a failover monitor for the gateway and the rx bytes function reader // This is a simple wrapper over `NewDroppedMonitor` to create one with the default settings // If this function returns True, the connection is dropped. False means it has exited and we don't know for sure if it's dropped or not -func New(readRxBytes func() (int64, error), logger log.FileLogger) (*DroppedConMon, error) { - return NewDroppedMonitor(pInterval, pAlive, pDropped, readRxBytes, logger) +func New(readRxBytes func() (int64, error), logger log.FileLogger) *DroppedConMon { + return NewDroppedMonitor(pInterval, pDropped, readRxBytes, logger) } |
