summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-13 15:46:50 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-13 15:46:50 -0300
commit4e3b2f09f0e5fba35aef3edf8ad2b23c64a5d995 (patch)
tree741a502645d0ab9c9ecb549d44f9a73d22748d33 /src
parent452d1b3a0ab64a6d1e742a74c369336dcdf91897 (diff)
Use a unix socket every time for now
Will need a special case for windows
Diffstat (limited to 'src')
-rw-r--r--src/leap/gui/mainwindow.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index 6aaf0a38..c2c37485 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -20,7 +20,7 @@ Main window for the leap client
"""
import os
import logging
-import random
+import tempfile
import keyring
from PySide import QtCore, QtGui
@@ -603,12 +603,27 @@ class MainWindow(QtGui.QMainWindow):
self._systray.setIcon(self.LOGGED_IN_ICON)
self._download_eip_config()
+ def _get_socket_host(self):
+ """
+ Returns the socket and port to be used for VPN
+
+ @rtype: tuple (str, str) (host, port)
+ """
+
+ # TODO: make this properly multiplatform
+ host = os.path.join(tempfile.mkdtemp(prefix="leap-tmp"),
+ 'openvpn.socket')
+ port = "unix"
+
+ return host, port
+
def _start_eip(self):
try:
+ host, port = self._get_socket_host()
self._vpn.start(eipconfig=self._eip_config,
providerconfig=self._provider_config,
- socket_host="localhost",
- socket_port=str(random.randint(1000, 9999)))
+ socket_host=host,
+ socket_port=port)
self._vpn_systray.setVisible(True)
self.ui.btnEipStartStop.setText(self.tr("Stop EIP"))
self.ui.btnEipStartStop.disconnect(self)