Problem listening on external IP
Posted: July 20th, 2008, 12:22 am
Since upgrading to 0.4.2 from 0.3.4 I've had trouble getting SABnzbd to listen on my server's external IP, it seemed to ignore config settings and reset the listen host to 0.0.0.0. This wasn't a problem in 0.3.4, but it seems something's changed in CherryPy and 0.0.0.0 no longer means 'listen on every IP' (at least, I think that's the problem. I couldn't find much in the way of documentation for that behaviour, and I'm no Python programmer).
After some cackhanded fiddling around I tracked it down to Sab looking up my server's hostname, which was returning its FQDN, and due to laziness/'security reasons' (mainly the former, I'll admit
) my server's FQDN doesn't actually resolve to anything. So Sab is detecting the error and resetting the IP to 0.0.0.0. Which isn't doing what it used to do.
Anyway, here's a simple patch which solves the problem (at least for me):
I really am no good at Python, so that might be entirely wrong, but it seems more logical to look up the IP in the config rather than guessing based on the server's hostname.
After some cackhanded fiddling around I tracked it down to Sab looking up my server's hostname, which was returning its FQDN, and due to laziness/'security reasons' (mainly the former, I'll admit
Anyway, here's a simple patch which solves the problem (at least for me):
Code: Select all
--- SABnzbd.py 2008-07-20 04:52:31.000000000 +0100
+++ SABnzbd.py 2008-07-20 05:58:59.000000000 +0100
-615,5 +615,5 @@
localhost = hostip = 'localhost'
try:
- info = socket.getaddrinfo(socket.gethostname(), None)
+ info = socket.getaddrinfo(cherryhost, None)
except:
# Hostname does not resolve, use 0.0.0.0