Browse Source

Better error messages when socket could not be opened

tests
Sebastian Lohff 10 years ago
parent
commit
2ce2a9c228
  1. 13
      servefile

13
servefile

@ -798,10 +798,15 @@ class ServeFile(): @@ -798,10 +798,15 @@ class ServeFile():
self.handler = self._confAndFindHandler()
self.server = []
if self.listenIPv4:
self.server.append(self._createServer(self.handler))
if self.listenIPv6:
self.server.append(self._createServer(self.handler, withv6=True))
try:
currsocktype = "IPv4"
if self.listenIPv4:
self.server.append(self._createServer(self.handler))
currsocktype = "IPv6"
if self.listenIPv6:
self.server.append(self._createServer(self.handler, withv6=True))
except socket.error as e:
raise ServeFileException("Could not open %s socket: %s" % (currsocktype, e))
if self.serveMode != self.MODE_UPLOAD:
print("Serving \"%s\" at port %d." % (self.target, self.port))

Loading…
Cancel
Save