diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py
index f5eea4c..30a8b22 100644
a
|
b
|
def on_ed_response(response):
|
306 | 306 | ed.addCallback(on_ed_response) |
307 | 307 | else: |
308 | 308 | component.start() |
| 309 | |
| 310 | # Check to warn user if deluge is using an invalid listening port if fixed listening ports are required |
| 311 | if not config["random_port"]: |
| 312 | self.core_config = {} |
| 313 | def _on_get_config(config): |
| 314 | # Current configuration obtained - saving and fetching the actual listening port in use |
| 315 | self.core_config = config |
| 316 | client.core.get_listen_port().addCallback(_on_get_listen_port) |
| 317 | |
| 318 | def _on_get_listen_port(port): |
| 319 | # Listening port obtained - warning user if it is not as configured |
| 320 | if not port in range(self.core_config["listen_ports"][0], self.core_config["listen_ports"][1] + 1): |
| 321 | dialogs.ErrorDialog( |
| 322 | _("Listening Port Warning"), |
| 323 | _("%d is in use however the range %d-%d has been configured.\n\nIf the specified range has been forwarded through a NAT and/or firewall then you will receive no incoming connections.") % (port, self.core_config["listen_ports"][0], self.core_config["listen_ports"][1]), |
| 324 | details=_("This likely occurred as libtorrent was unable to bind a listening port\nin the range given - make sure no other programs are using these ports.\nIf this occurred after deluge was restarted then the network stack\nmay think the chosen port is still in use - please shutdown deluge, wait\n10 seconds then start up again. If this still fails, please define a broader\nlistening port range.") |
| 325 | ).run() |
| 326 | |
| 327 | # Cleaning up |
| 328 | del self.core_config |
| 329 | |
| 330 | # Obtaining current configuration |
| 331 | client.core.get_config().addCallback(_on_get_config) |
| 332 | |
309 | 333 | return |
310 | 334 | |
311 | 335 | else: |
diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py
index 7ba931a..a02c4e9 100644
a
|
b
|
def on_response(response):
|
853 | 853 | _("You must now restart the deluge UI") |
854 | 854 | ) |
855 | 855 | dialog.run() |
| 856 | else: |
| 857 | # No major GUI changes |
| 858 | # Checking whether the listening port range has been changed (including when the listening interface changes) |
| 859 | if not new_core_config["random_port"] and ("listen_interface" in config_to_set or "listen_ports" in config_to_set): |
| 860 | # Change detected - need to verify listening port has been set properly |
| 861 | from twisted.internet import reactor |
| 862 | reactor.callLater(0.5, lambda: client.core.get_listen_port().addCallback(_on_get_listen_port)) |
| 863 | |
| 864 | def _on_get_listen_port(port): |
| 865 | # Listening port obtained - warning user if it is not as configured |
| 866 | if not port in range(self.core_config["listen_ports"][0], self.core_config["listen_ports"][1] + 1): |
| 867 | dialogs.ErrorDialog( |
| 868 | _("Listening Port Warning"), |
| 869 | _("%d is in use however the range %d-%d has been configured.\n\nIf the specified range has been forwarded through a NAT and/or firewall then you will receive no incoming connections.") % (port, self.core_config["listen_ports"][0], self.core_config["listen_ports"][1]), |
| 870 | details=_("This likely occurred as libtorrent was unable to bind a listening port\nin the range given - make sure no other programs are using these ports.\nIf this occurred after deluge was restarted then the network stack\nmay think the chosen port is still in use - please shutdown deluge, wait\n10 seconds then start up again. If this still fails, please define a broader\nlistening port range.") |
| 871 | ).run() |
856 | 872 | |
857 | 873 | def hide(self): |
858 | 874 | self.builder.get_object("port_img").hide() |