type
TDSServerSSLTransport =
class(TDSServerTransport)
strict private
FPort: Integer;
FMaxThreads: Integer;
FPoolSize: Integer;
FProtocolHandlerFactory: TDSJSONProtocolHandlerFactory;
procedure DoOnConnect(AContext: TIdContext);
procedure DoOnDisconnect(AContext: TIdContext);
procedure DoOnExecute(AContext: TIdContext);
protected
FTcpServer: TIdTCPServer;
FIdServerIOHandlerSSLOpenSSL : TIdServerIOHandlerSSLOpenSSL;
procedure SetServer(
const AServer: TDSCustomServer);
override;
procedure Notification(AComponent: TComponent; Operation: TOperation);
override;
public
destructor Destroy;
override;
constructor Create(AOwner: TComponent);
override;
procedure Start;
override;
procedure Stop;
override;
published
property Port: Integer
read FPort
write FPort
default 211;
property MaxThreads: Integer
read FMaxThreads
write FMaxThreads
default 0;
property PoolSize: Integer
read FPoolSize
write FPoolSize
default 10;
property Server;
property BufferKBSize;
property SSLIO: TIdServerIOHandlerSSLOpenSSL
read FIdServerIOHandlerSSLOpenSSL
write FIdServerIOHandlerSSLOpenSSL;
end;
[...]
procedure TDSServerSSLTransport.DoOnConnect(AContext: TIdContext);
var
Channel: TDBXChannel;
begin
if (AContext.Connection.IOHandler
is TIdSSLIOHandlerSocketBase)
then //Aus dem Indy SSL Beispiel
TIdSSLIOHandlerSocketBase(AContext.Connection.IOHandler).PassThrough:= false;
//entnommen.
Channel := TDSTCPSSLChannel.Create(AContext);
Channel.Open;
AContext.Data := FProtocolHandlerFactory.CreateProtocolHandler(Channel);
end;
[...]
procedure TDSServerSSLTransport.Start;
var
Scheduler: TIdSchedulerOfThreadPool;
begin
inherited;
FIdServerIOHandlerSSLOpenSSL := TIdServerIOHandlerSSLOpenSSL.Create(FTcpServer);
//IOHandler angepasst
FTcpServer := TIdTCPServer.Create(
nil);
FTcpServer.OnConnect := DoOnConnect;
FTcpServer.OnDisconnect := DoOnDisconnect;
FTcpServer.OnExecute := DoOnExecute;
FTcpServer.Bindings.Add.Port := FPort;
Scheduler := TIdSchedulerOfThreadPool.Create(FTCPServer);
Scheduler.MaxThreads := MaxThreads;
Scheduler.PoolSize := PoolSize;
FTCPServer.Scheduler := Scheduler;
FTcpServer.Active := True;
end;