Skip to content

Commit c3c2229

Browse files
committed
XAsynchSockets: Add security to free bad scokets
1 parent 70fb8dd commit c3c2229

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

MicroWebSrv2/libs/XAsyncSockets.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def jobReadyForReading(args) :
136136
self._udpSockEvt.recv_into(udpSockEvtBuf)
137137
else :
138138
asyncSocket = self._asyncSockets.get(sock.fileno())
139-
if asyncSocket :
139+
if asyncSocket and asyncSocket.GetSocketObj() == sock :
140140
if self._socketListAdd(sock, self._handlingList) :
141141
if socketsList is rd :
142142
if self._microWorkers :
@@ -691,6 +691,7 @@ def OnReadyForReading(self) :
691691
if not self.IsSSL or self._socket.pending() == 0 :
692692
return
693693
else :
694+
self._asyncSocketsPool.NotifyNextReadyForReading(self, False)
694695
return
695696

696697
# ------------------------------------------------------------------------
@@ -825,6 +826,8 @@ def _doSSLHandshake(self) :
825826
raise XAsyncTCPClientException('SSL : Bad handshake : %s' % sslErr)
826827
except Exception as ex :
827828
raise XAsyncTCPClientException('SSL : Handshake error : %s' % ex)
829+
else :
830+
raise XAsyncTCPClientException('SSL : Handshake error')
828831

829832
# ------------------------------------------------------------------------
830833

0 commit comments

Comments
 (0)