File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1027,24 +1027,26 @@ def _setSocketPreConnect():
10271027 def _ ():
10281028 while kb .threadContinue :
10291029 try :
1030- for address in socket ._ready :
1031- if len (socket ._ready [address ]) < SOCKET_PRE_CONNECT_QUEUE_SIZE :
1032- s = socket .socket ()
1030+ for key in socket ._ready :
1031+ if len (socket ._ready [key ]) < SOCKET_PRE_CONNECT_QUEUE_SIZE :
1032+ family , type , proto , address = key
1033+ s = socket .socket (family , type , proto )
10331034 s ._connect (address )
10341035 with kb .locks .socket :
1035- socket ._ready [address ].append (s ._sock )
1036+ socket ._ready [key ].append (s ._sock )
10361037 except socket .error :
10371038 pass
10381039 finally :
10391040 time .sleep (0.01 )
10401041
10411042 def connect (self , address ):
10421043 found = False
1044+ key = (self .family , self .type , self .proto , address )
10431045 with kb .locks .socket :
1044- if address not in socket ._ready :
1045- socket ._ready [address ] = []
1046- if len (socket ._ready [address ]) > 0 :
1047- self ._sock = socket ._ready [address ].pop (0 )
1046+ if key not in socket ._ready :
1047+ socket ._ready [key ] = []
1048+ if len (socket ._ready [key ]) > 0 :
1049+ self ._sock = socket ._ready [key ].pop (0 )
10481050 found = True
10491051 if not found :
10501052 self ._connect (address )
You can’t perform that action at this time.
0 commit comments