🐛 Stop broadcasting to unauthenticated sockets

Change and radar packets reached every connected socket, leaking
map edit activity to anyone who had opened a connection without
logging in. The state sweep also ran per loop tick; it now runs
once per second.
This commit is contained in:
2026-11-15 22:08:32 +01:00
parent 4a7f525937
commit 7acd461086
+9 -2
View File
@@ -48,6 +48,7 @@ type
FTCPServer: TLTcp;
FQuit: Boolean;
FLastFlush: TDateTime;
FLastNetCheck: TDateTime;
FValid: Boolean;
procedure OnAccept(ASocket: TLSocket);
procedure OnCanSend(ASocket: TLSocket);
@@ -121,6 +122,7 @@ begin
FTCPServer.OnError := @OnError;
FQuit := False;
FLastFlush := Now;
FLastNetCheck := Now;
end;
destructor TCEDServer.Destroy;
@@ -321,7 +323,11 @@ begin
begin
repeat
FTCPServer.CallAction;
CheckNetStates;
if SecondsBetween(FLastNetCheck, Now) >= 1 then
begin
CheckNetStates;
FLastNetCheck := Now;
end;
if SecondsBetween(FLastFlush, Now) >= 60 then
begin
FLandscape.Flush;
@@ -349,7 +355,8 @@ begin
while FTCPServer.IterNext do
begin
netState := TNetState(FTCPServer.Iterator.UserData);
if (netState <> nil) and (FTCPServer.Iterator.ConnectionStatus = scConnected) then
if (netState <> nil) and (netState.Account <> nil) and
(FTCPServer.Iterator.ConnectionStatus = scConnected) then
begin
netState.SendQueue.Seek(0, soFromEnd);
netState.SendQueue.CopyFrom(APacket.Stream, 0);