From c4e20291797583b2d172f804c0c684747279e70a Mon Sep 17 00:00:00 2001 From: Ondrej Pokorny Date: Sat, 14 Aug 2021 06:17:46 +0200 Subject: [PATCH] Ignore exceptions --- packages/fcl-net/src/ssockets.pp | 5 ++++- packages/fcl-web/src/base/fphttpserver.pp | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/fcl-net/src/ssockets.pp b/packages/fcl-net/src/ssockets.pp index fa2cf78261..eb4d60bf37 100644 --- a/packages/fcl-net/src/ssockets.pp +++ b/packages/fcl-net/src/ssockets.pp @@ -497,7 +497,10 @@ begin IOTimeout := TimeOut; FHandler.Recv(B,0); Result := FHandler.FLastError=0; - IOTimeout := lTM; + try + IOTimeout := lTM; + except + end; end; Function TSocketStream.Read (Var Buffer; Count : Longint) : longint; diff --git a/packages/fcl-web/src/base/fphttpserver.pp b/packages/fcl-web/src/base/fphttpserver.pp index e530c42d52..520296d233 100644 --- a/packages/fcl-web/src/base/fphttpserver.pp +++ b/packages/fcl-web/src/base/fphttpserver.pp @@ -656,11 +656,11 @@ begin try repeat FConnection.HandleRequest; - if Connection.EnableKeepAlive and Connection.KeepAlive + if not Terminated and Connection.EnableKeepAlive and Connection.KeepAlive and not Connection.Socket.CanRead(Connection.KeepAliveTimeout) then break; FConnection.HandleRequest; - until not (FConnection.EnableKeepAlive and FConnection.KeepAlive and (FConnection.Socket.LastError=0)); + until not (Terminated and FConnection.EnableKeepAlive and FConnection.KeepAlive and (FConnection.Socket.LastError=0)); finally FreeAndNil(FConnection); if Assigned(FThreadList) then @@ -988,7 +988,7 @@ begin try for I:= ThreadList.Count-1 downto 0 do try - CloseSocket(TFPHTTPConnectionThread(ThreadList[I]).Connection.Socket.Handle); + CloseSocket(TFPHTTPConnectionThread(ThreadList[I]).Connection.Socket.Handle); except // ignore exceptions during CloseSocket end