Browse code

stop VPN before connecting to a new server

Fixes #29

Joseph Weston authored on 19/07/2018 21:39:59
Showing 1 changed files
... ...
@@ -67,6 +67,8 @@ async def _run_vpn(connect_vpn, send_peers, on_shutdown, queue, log):
67 67
                 country = message['country']
68 68
                 log.info('VPN connect', country=country)
69 69
                 await send_peers(state='connecting', country=country)
70
+                await _stop(vpn_task)
71
+                vpn_task = None
70 72
                 host, vpn_task = await connect_vpn(country)
71 73
                 await send_peers(state='connected', host=host)
72 74
             elif message['method'] == 'disconnect':