From c3c2229fd23ee0bfb97e0bde640f3a12e2057d09 Mon Sep 17 00:00:00 2001 From: jczic Date: Tue, 5 Mar 2024 21:09:02 +0100 Subject: [PATCH] XAsynchSockets: Add security to free bad scokets --- MicroWebSrv2/libs/XAsyncSockets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MicroWebSrv2/libs/XAsyncSockets.py b/MicroWebSrv2/libs/XAsyncSockets.py index 4b43e06..128a284 100644 --- a/MicroWebSrv2/libs/XAsyncSockets.py +++ b/MicroWebSrv2/libs/XAsyncSockets.py @@ -136,7 +136,7 @@ def jobReadyForReading(args) : self._udpSockEvt.recv_into(udpSockEvtBuf) else : asyncSocket = self._asyncSockets.get(sock.fileno()) - if asyncSocket : + if asyncSocket and asyncSocket.GetSocketObj() == sock : if self._socketListAdd(sock, self._handlingList) : if socketsList is rd : if self._microWorkers : @@ -691,6 +691,7 @@ def OnReadyForReading(self) : if not self.IsSSL or self._socket.pending() == 0 : return else : + self._asyncSocketsPool.NotifyNextReadyForReading(self, False) return # ------------------------------------------------------------------------ @@ -825,6 +826,8 @@ def _doSSLHandshake(self) : raise XAsyncTCPClientException('SSL : Bad handshake : %s' % sslErr) except Exception as ex : raise XAsyncTCPClientException('SSL : Handshake error : %s' % ex) + else : + raise XAsyncTCPClientException('SSL : Handshake error') # ------------------------------------------------------------------------