From 8bc4f9badd3faa44e245fd3fb1e4cebdd215bc9c Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 22 Apr 2024 16:24:21 +0200 Subject: Client: Cancel ProxyGuard in Cleanup function Clients like Android currently do not cleanup ProxyGuard, whilst they should, it makes sense to just cancel it for them. Cleanup should be called if possible by the client anyways. --- client/client.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'client/client.go') diff --git a/client/client.go b/client/client.go index 773df54..7a6747b 100644 --- a/client/client.go +++ b/client/client.go @@ -49,6 +49,9 @@ type Client struct { // cfg is the config cfg *config.Config + // proxy is proxyguard + proxy Proxy + mu sync.Mutex } @@ -486,6 +489,11 @@ func (c *Client) retrieveTokens(sid string, t srvtypes.Type) (*eduoauth.Token, e // Cleanup cleans up the VPN connection by sending a /disconnect func (c *Client) Cleanup(ck *cookie.Cookie) error { + // cleanup proxyguard + cerr := c.proxy.Cancel() + if cerr != nil { + log.Logger.Debugf("ProxyGuard cancel gave an error: %v", cerr) + } srv, err := c.Servers.CurrentServer() if err != nil { return i18nerr.Wrap(err, "The current server was not found when cleaning up the connection") -- cgit v1.2.3