forked from seba/servefile
Better error messages when socket could not be opened
This commit is contained in:
parent
f48838f63c
commit
2ce2a9c228
13
servefile
13
servefile
|
@ -798,10 +798,15 @@ class ServeFile():
|
||||||
self.handler = self._confAndFindHandler()
|
self.handler = self._confAndFindHandler()
|
||||||
self.server = []
|
self.server = []
|
||||||
|
|
||||||
if self.listenIPv4:
|
try:
|
||||||
self.server.append(self._createServer(self.handler))
|
currsocktype = "IPv4"
|
||||||
if self.listenIPv6:
|
if self.listenIPv4:
|
||||||
self.server.append(self._createServer(self.handler, withv6=True))
|
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:
|
if self.serveMode != self.MODE_UPLOAD:
|
||||||
print("Serving \"%s\" at port %d." % (self.target, self.port))
|
print("Serving \"%s\" at port %d." % (self.target, self.port))
|
||||||
|
|
Loading…
Reference in New Issue