@@ -452,7 +452,7 @@ class Listener(object):
452452 This is a wrapper for a bound socket which is 'listening' for
453453 connections, or for a Windows named pipe.
454454 '''
455- def __init__ (self , address = None , family = None , backlog = 1 , authkey = None ):
455+ def __init__ (self , address = None , family = None , backlog = None , authkey = None ):
456456 family = family or (address and address_type (address )) \
457457 or default_family
458458 address = address or arbitrary_address (family )
@@ -597,7 +597,7 @@ class SocketListener(object):
597597 '''
598598 Representation of a socket which is bound to an address and listening
599599 '''
600- def __init__ (self , address , family , backlog = 1 ):
600+ def __init__ (self , address , family , backlog = None ):
601601 self ._socket = socket .socket (getattr (socket , family ))
602602 try :
603603 # SO_REUSEADDR has different semantics on Windows (issue #2550).
@@ -606,7 +606,10 @@ def __init__(self, address, family, backlog=1):
606606 socket .SO_REUSEADDR , 1 )
607607 self ._socket .setblocking (True )
608608 self ._socket .bind (address )
609- self ._socket .listen (backlog )
609+ if backlog is None :
610+ self ._socket .listen ()
611+ else :
612+ self ._socket .listen (backlog )
610613 self ._address = self ._socket .getsockname ()
611614 except OSError :
612615 self ._socket .close ()
0 commit comments