def connectToValidated(self, connection, wait):
# Given the number of a validated connection, connect to it. Return True when the connection has happened
# or False if there's a problem connecting (or there's not a VPN connection available for this connection
# number). Return True without messing with the connection if the current VPN is the same as the VPN being
# requested. The wait parameter will determine if the function returns once the connection has been made,
# or if it's fire and forget (in which case True will be returned regardless)
if not self.isVPNSetUp(): return False
if connection < 1 or connection > 10: return False
connection = connection - 1
self.refreshLists()
if self.primary_vpns[connection] == "": return False
if self.getConnected() == self.primary_vpns[connection]: return True
xbmc.log(msg="VPN Mgr API : Connecting to " + self.primary_vpns[connection], level=xbmc.LOGDEBUG)
self.setAPICommand(self.primary_vpns[connection])
if wait: return self.waitForConnection(self.primary_vpns[connection])
return True
评论列表
文章目录