From 924dd1fdec6cf4d1d5a304e2f5a1a1d7662372bb Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 17 Apr 2023 13:37:22 +0200 Subject: Client: Re-create failover object on new call This additional bookkeeping is not needed now because we have contexts --- client/client.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'client') diff --git a/client/client.go b/client/client.go index 28080b0..d6b3597 100644 --- a/client/client.go +++ b/client/client.go @@ -109,9 +109,6 @@ type Client struct { // Whether to enable debugging Debug bool `json:"-"` - // The Failover monitor for the current VPN connection - Failover *failover.DroppedConMon `json:"-"` - // TokenSetter sets the tokens in the client TokenSetter func(srv srvtypes.Current, tok srvtypes.Tokens) `json:"-"` @@ -840,12 +837,8 @@ func (c *Client) RenewSession(ck *cookie.Cookie) (err error) { return c.callbacks(ck, srv, true) } -func (c *Client) StartFailover(ck *cookie.Cookie, gateway string, wgMTU int, readRxBytes func() (int64, error)) (bool, error) { - if c.Failover != nil { - return false, errors.New("another failover process is already started") - } - - c.Failover = failover.New(readRxBytes) +func (c *Client) StartFailover(ck *cookie.Cookie, gateway string, mtu int, readRxBytes func() (int64, error)) (bool, error) { + f := failover.New(readRxBytes) - return c.Failover.Start(ck.Context(), gateway, wgMTU) + return f.Start(ck.Context(), gateway, mtu) } -- cgit v1.2.3