Update TUN connect on Windows platform

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2023-11-06 08:27:57 +08:00
parent fe8820726b
commit 1b6024ed00
+10 -1
View File
@@ -1037,13 +1037,20 @@ class ConnectAction(Action):
break
eventLoopWait(100)
if not self.coreRunning:
foundDevice = False
break
else:
eventLoopWait(100)
if not foundDevice:
logger.error(
f'find TUN device \'{APPLICATION_TUN_DEVICE_NAME}\' failed'
)
return
RoutingTable.addRelations()
RoutingTable.setDeviceGatewayAddress(
APPLICATION_TUN_DEVICE_NAME,
@@ -1071,6 +1078,8 @@ class ConnectAction(Action):
if error:
self.coreRunning = False
self.disconnectReason = _('DNS resolution failed') + f': {coreAddr}'
RoutingTable.Relations.clear()
else:
for address in resolved:
RoutingTable.Relations.append([address, defaultGateway[0]])