Skip to content

Commit

Permalink
Merge pull request HashLoad#373 from NatanaelRibF/master
Browse files Browse the repository at this point in the history
Adicionado MaxConnections
  • Loading branch information
viniciussanchez authored Jan 15, 2024
2 parents 99b61b7 + 2679601 commit 06ed504
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Horse.Provider.Apache.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ interface
type
THorseProvider = class(THorseProviderAbstract)
private
class var FMaxConnections: Integer;
class var FHandlerName: string;
class var FDefaultModule: Pointer;

class procedure SetMaxConnections(const AValue: Integer); static;
class function GetMaxConnections: Integer; static;
class procedure InternalListen; static;
class procedure SetHandlerName(const AValue: string); static;
class function GetHandlerName: string; static;
class function GetDefaultModule: Pointer; static;
class procedure SetDefaultModule(const AValue: Pointer); static;
public
class property MaxConnections: Integer read GetMaxConnections write SetMaxConnections;
class property HandlerName: string read GetHandlerName write SetHandlerName;
class property DefaultModule: Pointer read GetDefaultModule write SetDefaultModule;
class procedure Listen; overload; override;
Expand Down Expand Up @@ -46,6 +51,12 @@ class procedure THorseProvider.InternalListen;
Web.ApacheApp.InitApplication(FDefaultModule, UTF8String(FHandlerName));
Application.Initialize;
Application.WebModuleClass := WebModuleClass;

if FMaxConnections > 0 then
begin
Application.MaxConnections:= FMaxConnections;
end;

DoOnListen;
Application.Run;
end;
Expand All @@ -63,6 +74,16 @@ class procedure THorseProvider.Listen(const ACallback: TProc);
InternalListen;
end;

class function THorseProvider.GetMaxConnections: Integer;
begin
Result := FMaxConnections;
end;

class procedure THorseProvider.SetMaxConnections(const AValue: Integer);
begin
FMaxConnections := AValue;
end;

class function THorseProvider.GetHandlerName: string;
begin
Result := FHandlerName;
Expand Down

0 comments on commit 06ed504

Please sign in to comment.