Skip to content

Commit

Permalink
Updates the copy of pyscgi to 1.16.1
Browse files Browse the repository at this point in the history
  • Loading branch information
alobbs committed Oct 20, 2011
1 parent a767e5c commit e75f53b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions CTK/pyscgi.py
Expand Up @@ -43,7 +43,7 @@
import sys
import os

__version__ = '1.16'
__version__ = '1.16.1'
__author__ = 'Alvaro Lopez Ortega'
__copyright__ = 'Copyright 2011, Alvaro Lopez Ortega'
__license__ = 'BSD'
Expand Down Expand Up @@ -199,19 +199,21 @@ def server_bind (self):
return SocketServer.TCPServer.server_bind (self)

def server_bind_multifamily (self):
s = None
# Loop over the different addresses of 'host'
host, port = self.server_address
addresses = socket.getaddrinfo (host, port, socket.AF_UNSPEC,
socket.SOCK_STREAM, 0, socket.AI_PASSIVE)

# Loop over the different options of 'host'
for res in socket.getaddrinfo (host, port, socket.AF_UNSPEC,
socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
s = None
# Find a suitable address
s = None
for res in addresses:
af, socktype, protocol, canonicalname, sa = res

# Create socket
try:
s = socket.socket (af, socktype, protocol)
except socket.error:
s = None
continue

# Bind
Expand All @@ -221,12 +223,13 @@ def server_bind_multifamily (self):
s.bind(sa)
except socket.error:
s.close()
s = None
continue

break

# If none successfully bind report error
if s is None:
if not s:
raise socket.error, "Could not create server socket"

self.socket = s
Expand Down

0 comments on commit e75f53b

Please sign in to comment.