[Zope-Checkins] SVN: Zope/trunk/lib/python/ZServer/medusa/ftp_server.py Collector #1992: unified visible hostname/ip address during the startup

Andreas Jung andreas at andreas-jung.com
Fri Jan 13 09:39:37 EST 2006


Log message for revision 41297:
  Collector #1992: unified visible hostname/ip address during the startup
  phase for FTP and HTTP servers
  

Changed:
  U   Zope/trunk/lib/python/ZServer/medusa/ftp_server.py

-=-
Modified: Zope/trunk/lib/python/ZServer/medusa/ftp_server.py
===================================================================
--- Zope/trunk/lib/python/ZServer/medusa/ftp_server.py	2006-01-13 14:29:32 UTC (rev 41296)
+++ Zope/trunk/lib/python/ZServer/medusa/ftp_server.py	2006-01-13 14:39:36 UTC (rev 41297)
@@ -706,12 +706,12 @@
         self.port = port
         self.authorizer = authorizer
 
-        if hostname is None:
-            self.hostname = socket.gethostname()
-        else:
-            self.hostname = hostname
-            
-            # statistics
+        try:
+            self.hostname = socket.gethostbyaddr(ip)[0]
+        except socket.error:
+            self.hostname = ip
+
+        # statistics
         self.total_sessions = counter()
         self.closed_sessions = counter()
         self.total_files_out = counter()



More information about the Zope-Checkins mailing list