Commit b4d13a0f authored by Sam Rushing's avatar Sam Rushing

server.start(): use self.create_sock() rather than assuming coro.tcp_sock()

parent 28a42eeb
......@@ -454,11 +454,11 @@ class server:
Try up to <retries> time to bind to that address.
Raises an exception if the bind fails."""
self.sock = coro.tcp_sock()
self.addr = addr
self.sock = self.create_sock()
self.sock.set_reuse_addr()
done = 0
save_errno = 0
self.addr = addr
while not done:
for x in xrange (retries):
try:
......@@ -501,6 +501,14 @@ class server:
def accept (self):
return self.sock.accept()
def create_sock (self):
# the assumption here is that you would never run an HTTP server
# on a unix socket, if you need that then override this method.
if ':' in self.addr[0]:
return coro.tcp6_sock()
else:
return coro.tcp_sock()
def create_connection (self):
return connection (self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment