Hello,
As the title says, in my WSocketMT/HTTPMT class which I also uploaded to
http://www.fastream.com/ics, the latest version includes code such as,
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*}
function TCustomWSocketMTServer.AfterClientCreated(
Client : TWSocketMTClient; Error: Word; NewHSocket: integer) : boolean;
var
currentClientCount: integer;
currentMaxClients: integer;
begin
Result := TRUE;
FCriticalSection.Acquire;
try
Inc(FClientNum);
Client.Name := Name + 'Client' + IntToStr(FClientNum);
FClientList.Add(Client);
currentClientCount := FClientList.Count;
Client.Banner := FBanner;
Client.Server := Self;
currentMaxClients := FMaxClients;
{$IFNDEF NO_DEBUG_LOG}
Client.IcsLogger := IcsLogger; {
V5.04 }
{$ENDIF}
Client.Dup(NewHSocket);
TriggerClientConnect(Client, Error);
finally
FCriticalSection.Release;
end;
{ Ok, the client is still there, process with the connection }
if (currentMaxClients > 0) and (currentClientCount > currentMaxClients)
then begin
{ Sorry, too much clients }
FCriticalSection.Acquire;
Client.Banner := BannerTooBusy;
FCriticalSection.Release;
Client.StartConnection;
Client.CloseDelayed;
Result := false;
end;
end;
I call this function after the client is created and posted to the worker
thread, from within the worker thread context. I get "TList out of bounds"
exception! I am not sure which line since if I run in the debug mode, in 1
sec, it gives "Out of memory" due to RAM fragmentation. Any idea what could
cause the FClientList to fire such an exception??
Best Regards,
SZ
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be