[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Be more helpful when bind(2) fails.



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv15745/lib/mixminion/server

Modified Files:
	MMTPServer.py 
Log Message:
Be more helpful when bind(2) fails.

Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- MMTPServer.py	25 Aug 2003 21:05:34 -0000	1.48
+++ MMTPServer.py	3 Sep 2003 15:55:20 -0000	1.49
@@ -202,7 +202,11 @@
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         self.sock.setblocking(0)
         self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
-        self.sock.bind((self.ip, self.port))
+        try:
+            self.sock.bind((self.ip, self.port))
+        except socket.error, e:
+            raise MixFatalError("Error while trying to bind to %s:%s: %s"%(
+                self.ip, self.port, e))
         self.sock.listen(backlog)
         self.connectionFactory = connectionFactory
         info("Listening at %s on port %s (fd %s)", ip, port,self.sock.fileno())