| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7fa9c8e commit a548951
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1027,24 +1027,26 @@ def _setSocketPreConnect(): | |||
| 1027 | 1027 | def _(): | |
| 1028 | 1028 | while kb.threadContinue: | |
| 1029 | 1029 | 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) | ||
| 1033 | 1034 | s._connect(address) | |
| 1034 | 1035 | with kb.locks.socket: | |
| 1035 | - socket._ready[address].append(s._sock) | ||
| 1036 | + socket._ready[key].append(s._sock) | ||
| 1036 | 1037 | except socket.error: | |
| 1037 | 1038 | pass | |
| 1038 | 1039 | finally: | |
| 1039 | 1040 | time.sleep(0.01) | |
| 1040 | 1041 | ||
| 1041 | 1042 | def connect(self, address): | |
| 1042 | 1043 | found = False | |
| 1044 | + key = (self.family, self.type, self.proto, address) | ||
| 1043 | 1045 | 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) | ||
| 1048 | 1050 | found = True | |
| 1049 | 1051 | if not found: | |
| 1050 | 1052 | self._connect(address) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments