🚨 Isolate packet handler exceptions on the client

A handler exception left the packet in the queue, re-raising on
every receive until the app aborted. The connection is now dropped
cleanly with a log entry.
This commit is contained in:
2026-11-15 22:06:51 +01:00
parent ad38619b9b
commit c4f043a236
+12 -1
View File
@@ -79,7 +79,7 @@ uses
UfrmBoundaries, UfrmElevateSettings, UfrmConfirmation, UfrmMoveSettings,
UfrmAbout, UfrmHueSettings, UfrmRadar, UfrmLargeScaleCommand,
UfrmVirtualLayer, UfrmFilter, UfrmRegionControl, UfrmLightlevel,
UfrmChangePassword;
UfrmChangePassword, Logging;
{$I version.inc}
@@ -279,7 +279,18 @@ begin
if FReceiveQueue.Size >= size then
begin
FReceiveQueue.Lock(FReceiveQueue.Position, size - FReceiveQueue.Position); //prevent handler from reading too much
try
packetHandler.Process(FReceiveQueue);
except
on E: Exception do
begin
Logger.Send([lcClient, lcError], 'Packet handler exception: %s', [E.Message]);
FReceiveQueue.Unlock;
Disconnect;
FReceiveQueue.Clear;
Exit;
end;
end;
FReceiveQueue.Unlock;
FReceiveQueue.Dequeue(size);
end else