[#2343] Fix error if listen interface is whitespace

Whitespace in the interface dialog is not obvious to the user so
strip in core to prevent error from bad config
This commit is contained in:
Calum Lind 2014-02-18 19:06:53 +00:00
commit d04af1e392

View file

@ -251,7 +251,7 @@ class PreferencesManager(component.Component):
# Only set the listen ports if random_port is not true # Only set the listen ports if random_port is not true
if self.config["random_port"] is not True: if self.config["random_port"] is not True:
log.debug("listen port range set to %s-%s", value[0], value[1]) log.debug("listen port range set to %s-%s", value[0], value[1])
self.session.listen_on(value[0], value[1], str(self.config["listen_interface"])) self.session.listen_on(value[0], value[1], str(self.config["listen_interface"]).strip())
def _on_set_listen_interface(self, key, value): def _on_set_listen_interface(self, key, value):
# Call the random_port callback since it'll do what we need # Call the random_port callback since it'll do what we need
@ -273,7 +273,7 @@ class PreferencesManager(component.Component):
# Set the listen ports # Set the listen ports
log.debug("listen port range set to %s-%s", listen_ports[0], log.debug("listen port range set to %s-%s", listen_ports[0],
listen_ports[1]) listen_ports[1])
self.session.listen_on(listen_ports[0], listen_ports[1], str(self.config["listen_interface"])) self.session.listen_on(listen_ports[0], listen_ports[1], str(self.config["listen_interface"]).strip())
def _on_set_outgoing_ports(self, key, value): def _on_set_outgoing_ports(self, key, value):
if not self.config["random_outgoing_ports"]: if not self.config["random_outgoing_ports"]: