@@ -49,7 +49,8 @@ TRALSaguiServer = class(TRALServer)
4949 private
5050 FHandle: Psg_httpsrv;
5151 FLibPath: TFileName;
52-
52+ FPoolCount: IntegerRAL;
53+ FConnectionLimit: Int64RAL;
5354 class procedure DecodeAuth (AAuthorization: StringRAL; AResult: TRALRequest);
5455 class procedure DoClientConnectionCallback (Acls: Pcvoid; const Aclient: Pcvoid;
5556 Aclosed: Pcbool); cdecl; static;
@@ -60,6 +61,10 @@ TRALSaguiServer = class(TRALServer)
6061 Asize: csize_t): cssize_t; cdecl; static;
6162 class procedure DoStreamFree (Acls: Pcvoid); cdecl; static;
6263 class function GetSaguiIP (AReq: Psg_httpreq): StringRAL;
64+ procedure SetConnectionLimit (const Value : Int64RAL);
65+ procedure SetPoolCount (const Value : IntegerRAL);
66+ function GetPoolCount : IntegerRAL;
67+ function GetConnectionLimit : Int64RAL;
6368 protected
6469 function CreateRALSSL : TRALSSL; override;
6570 procedure CreateServerHandle ;
@@ -78,7 +83,9 @@ TRALSaguiServer = class(TRALServer)
7883 constructor Create(AOwner: TComponent); override;
7984 destructor Destroy; override;
8085 published
86+ property ConnectionLimit: Int64RAL read GetConnectionLimit write SetConnectionLimit default 1000 ;
8187 property LibPath: TFileName read FLibPath write SetLibPath;
88+ property PoolCount: IntegerRAL read GetPoolCount write SetPoolCount default 32 ;
8289 property SSL: TRALSaguiSSL read GetSSL write SetSSL;
8390 end ;
8491
@@ -186,6 +193,9 @@ constructor TRALSaguiServer.Create(AOwner: TComponent);
186193 { $ELSE}
187194 FLibPath := SgLib.GetLastName;
188195 { $ENDIF}
196+
197+ ConnectionLimit := -4 ;
198+ PoolCount := -1 ;
189199end ;
190200
191201function TRALSaguiServer.CreateRALSSL : TRALSSL;
@@ -410,6 +420,16 @@ procedure TRALSaguiServer.FreeServerHandle;
410420 FHandle := nil ;
411421end ;
412422
423+ function TRALSaguiServer.GetConnectionLimit : Int64RAL;
424+ begin
425+ Result := FConnectionLimit;
426+ end ;
427+
428+ function TRALSaguiServer.GetPoolCount : IntegerRAL;
429+ begin
430+ Result := FPoolCount;
431+ end ;
432+
413433class function TRALSaguiServer.GetSaguiIP (AReq: Psg_httpreq): StringRAL;
414434var
415435 vIP: array [0 ..45 ] of cchar;
@@ -456,7 +476,7 @@ function TRALSaguiServer.GetSSL: TRALSaguiSSL;
456476
457477procedure TRALSaguiServer.SetActive (const AValue: boolean);
458478var
459- vActive : boolean;
479+ vActive: boolean;
460480begin
461481 vActive := Active;
462482
@@ -481,6 +501,8 @@ procedure TRALSaguiServer.SetActive(const AValue: boolean);
481501 CreateServerHandle;
482502 if not InitializeServer then
483503 FreeServerHandle;
504+ SetConnectionLimit(ConnectionLimit);
505+ SetPoolCount(PoolCount);
484506 end
485507 else
486508 begin
@@ -489,6 +511,13 @@ procedure TRALSaguiServer.SetActive(const AValue: boolean);
489511 end ;
490512end ;
491513
514+ procedure TRALSaguiServer.SetConnectionLimit (const Value : Int64RAL);
515+ begin
516+ FConnectionLimit := Value ;
517+ if FHandle <> nil then
518+ sg_httpsrv_set_con_limit(FHandle, Value );
519+ end ;
520+
492521procedure TRALSaguiServer.SetLibPath (const AValue: TFileName);
493522begin
494523 if AValue = FLibPath then
@@ -514,6 +543,13 @@ procedure TRALSaguiServer.ShutdownServerHandle;
514543 sg_httpsrv_shutdown(FHandle);
515544end ;
516545
546+ procedure TRALSaguiServer.SetPoolCount (const Value : IntegerRAL);
547+ begin
548+ FPoolCount := Value ;
549+ if FHandle <> nil then
550+ sg_httpsrv_set_thr_pool_size(FHandle, Value );
551+ end ;
552+
517553procedure TRALSaguiServer.SetPort (const AValue: IntegerRAL);
518554var
519555 vActive: boolean;
0 commit comments