summaryrefslogtreecommitdiff
path: root/src/leap/eip
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-09-20 05:00:32 +0900
committerkali <kali@leap.se>2012-09-20 05:00:32 +0900
commit1ab8247ecb8664af5159b7f1e050189f5e637146 (patch)
tree1fac7766356a2a69870fd0e00fd306131bd036a9 /src/leap/eip
parent50396fca082652dd1a1617e0d029c1c726e4c651 (diff)
parent3c7451d62363d0a3326552956db630dda09392fa (diff)
Merge branch 'feature/systray-menu' into develop
Close #536. Cleaning up of the systray menu. Main window starts hidden if not in debug mode. Incidentally, some fixes related to the subprocess invocation and termination, removing many of the annoying hangs during debug.
Diffstat (limited to 'src/leap/eip')
-rw-r--r--src/leap/eip/config.py1
-rw-r--r--src/leap/eip/openvpnconnection.py27
2 files changed, 16 insertions, 12 deletions
diff --git a/src/leap/eip/config.py b/src/leap/eip/config.py
index 44922310..e5fcd164 100644
--- a/src/leap/eip/config.py
+++ b/src/leap/eip/config.py
@@ -112,7 +112,6 @@ def build_ovpn_options(daemon=False, socket_path=None, **kwargs):
# remote
opts.append('--remote')
gw = get_eip_gateway()
- #gw = "springbokvpn.org"
logger.debug('setting eip gateway to %s', gw)
opts.append(str(gw))
opts.append('1194')
diff --git a/src/leap/eip/openvpnconnection.py b/src/leap/eip/openvpnconnection.py
index 65683485..f4d1c449 100644
--- a/src/leap/eip/openvpnconnection.py
+++ b/src/leap/eip/openvpnconnection.py
@@ -99,12 +99,9 @@ to be triggered for each one of them.
ovpn_verbosity=self.ovpn_verbosity)
except eip_exceptions.EIPNoPolkitAuthAgentAvailable:
command = args = None
- # XXX deprecate
- #self.missing_auth_agent = True
raise
except eip_exceptions.EIPNoPkexecAvailable:
command = args = None
- #self.missing_pkexec = True
raise
# XXX if not command, signal error.
@@ -158,7 +155,7 @@ to be triggered for each one of them.
if self.command is None:
raise eip_exceptions.EIPNoCommandError
if self.subp is not None:
- print('cowardly refusing to launch subprocess again')
+ logger.debug('cowardly refusing to launch subprocess again')
return
self._launch_openvpn()
@@ -166,8 +163,14 @@ to be triggered for each one of them.
"""
terminates child subprocess
"""
+ # XXX we should send a quit process using management
+ # interface.
if self.subp:
- self.subp.terminate()
+ try:
+ self.subp.terminate()
+ except OSError:
+ logger.error('cannot terminate subprocess!'
+ '(maybe openvpn still running?)')
#
# management methods
@@ -233,16 +236,17 @@ to be triggered for each one of them.
"""
Send a command to openvpn and return response as list
"""
- #logger.debug('connected? %s' % self.connected())
if not self.connected():
try:
- #logger.debug('try to connect')
self.connect_to_management()
except eip_exceptions.MissingSocketError:
- #XXX capture more helpful error
- return self.make_error()
- except:
- raise
+ logger.warning('missing management socket')
+ # This should only happen briefly during
+ # the first invocation. Race condition make
+ # the polling begin before management socket
+ # is ready
+ return []
+ #return self.make_error()
try:
if hasattr(self, 'tn'):
self.tn.write(cmd + "\n")
@@ -310,6 +314,7 @@ to be triggered for each one of them.
"""
OpenVPN command: status
"""
+ #logger.debug('status called')
status = self._send_command("status")
return status