IPv6: GUI and client fixes
This commit is contained in:
parent
83d12eca9f
commit
a78c646556
@ -11,7 +11,6 @@ import time
|
||||
from copy import deepcopy
|
||||
from functools import wraps
|
||||
|
||||
from twisted.internet.endpoints import HostnameEndpoint
|
||||
from twisted.internet.protocol import ClientFactory
|
||||
from twisted.internet import reactor, task, defer, threads
|
||||
|
||||
@ -726,9 +725,10 @@ class SyncplayClient(object):
|
||||
reactor.callLater(0.1, self._playerClass.run, self, self._config['playerPath'], self._config['file'], self._config['playerArgs'], )
|
||||
self._playerClass = None
|
||||
self.protocolFactory = SyncClientFactory(self)
|
||||
if '[' in host:
|
||||
host = host.strip('[]')
|
||||
port = int(port)
|
||||
self._endpoint = HostnameEndpoint(reactor, host, port)
|
||||
self._endpoint.connect(self.protocolFactory)
|
||||
reactor.connectTCP(host, port, self.protocolFactory)
|
||||
reactor.run()
|
||||
|
||||
def stop(self, promptForAction=False):
|
||||
|
||||
@ -313,16 +313,32 @@ class ConfigurationGetter(object):
|
||||
port = constants.DEFAULT_PORT if not self._config["port"] else self._config["port"]
|
||||
if host:
|
||||
if ':' in host:
|
||||
host, port = host.rsplit(':', 1)
|
||||
if '[' in host:
|
||||
host = host.strip('[]')
|
||||
try:
|
||||
port = int(port)
|
||||
except ValueError:
|
||||
if host.count(':') == 1:
|
||||
#IPv4 address or hostname, with port
|
||||
host, port = host.rsplit(':', 1)
|
||||
try:
|
||||
port = port.encode('ascii', 'ignore')
|
||||
except:
|
||||
port = ""
|
||||
port = int(port)
|
||||
except ValueError:
|
||||
try:
|
||||
port = port.encode('ascii', 'ignore')
|
||||
except:
|
||||
port = ""
|
||||
else:
|
||||
#IPv6 address
|
||||
if ']' in host:
|
||||
#IPv6 address in brackets
|
||||
endBracket = host.index(']')
|
||||
try:
|
||||
#port explicitely indicated
|
||||
port = int(host[endBracket+2:])
|
||||
except ValueError:
|
||||
#no port after the bracket
|
||||
pass
|
||||
host = host[:endBracket+1]
|
||||
else:
|
||||
#IPv6 address with no port and no brackets
|
||||
#add brackets to correctly store IPv6 addresses in configs
|
||||
host = '[' + host + ']'
|
||||
return host, port
|
||||
|
||||
def _checkForPortableFile(self):
|
||||
|
||||
@ -556,7 +556,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
||||
self.error = error
|
||||
if config['host'] is None:
|
||||
host = ""
|
||||
elif ":" in config['host']:
|
||||
elif ":" in config['host'] and '[' not in config['host']:
|
||||
host = config['host']
|
||||
else:
|
||||
host = config['host'] + ":" + str(config['port'])
|
||||
@ -580,7 +580,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
||||
i += 1
|
||||
self.hostCombobox.setEditable(True)
|
||||
self.hostCombobox.setEditText(host)
|
||||
self.hostCombobox.setFixedWidth(165)
|
||||
self.hostCombobox.setFixedWidth(250)
|
||||
self.hostLabel = QLabel(getMessage("host-label"), self)
|
||||
self.findServerButton = QtWidgets.QPushButton(QtGui.QIcon(resourcespath + 'arrow_refresh.png'), getMessage("update-server-list-label"))
|
||||
self.findServerButton.clicked.connect(self.updateServerList)
|
||||
@ -634,7 +634,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
||||
self.executablepathCombobox.setEditable(True)
|
||||
self.executablepathCombobox.currentIndexChanged.connect(self.updateExecutableIcon)
|
||||
self.executablepathCombobox.setEditText(self._tryToFillPlayerPath(config['playerPath'], playerpaths))
|
||||
self.executablepathCombobox.setFixedWidth(250)
|
||||
self.executablepathCombobox.setFixedWidth(330)
|
||||
self.executablepathCombobox.editTextChanged.connect(self.updateExecutableIcon)
|
||||
|
||||
self.executablepathLabel = QLabel(getMessage("executable-path-label"), self)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user