Info about active connections

This commit is contained in:
Ondrej Pokorny 2021-08-14 06:18:09 +02:00 committed by Michaël Van Canneyt
parent 52c00037d3
commit 7ccdcd3d14

View File

@ -13,6 +13,8 @@ Type
THTTPServer = class(TTestHTTPServer)
protected
function CreateConnection(Data: TSocketStream): TFPHTTPConnection; override;
public
Property ConnectionCount;
end;
TServerThread = class(TThread)
@ -53,7 +55,7 @@ begin
FServ.Threaded:=True;
FServ.Port:=8080;
FServ.WriteInfo := @WriteInfo;
FServ.AcceptIdleTimeout := 500;
FServ.AcceptIdleTimeout := 1000;
FServ.OnAcceptIdle := @ServOnIdle;
end;
@ -71,6 +73,7 @@ end;
procedure TServerThread.ServOnIdle(Sender: TObject);
begin
WriteInfo('Active connections: '+IntToStr(FServ.ConnectionCount));
if Terminated then
FServ.Active := False;
end;