Indy 9
|
MClientThread = class(TThread)
MClientThread is used to store references to the TCP client connection to the tunnel server, and the master thread used by the tunnel server to handle client requests.
MClientThread communicates with the tunnel server by reading messages from the outbound TCP client, and constructs headers that encapsulate the message for the tunnel server. When the TCP client is no longer readable, the MClientThread will terminate.
MClientThread notifies the tunnel server when a service thread is disconnected, and allows the tunnel server to maintain the number of connected services.
constructor Create(AMaster: TIdTunnelMaster);
Create adds the thread instance to MasterParent.Clients, and increments the TIdTunnelMaster number of services.
Create calls the inherited Create method to finalize construction of the thread instance.
destructor Destroy; override;
When DisconnectedOnRequest is False, MClientThread will also generate and send a Tunnel Disconnect message to the tunnel server.
If the TCP client is still connected, the OutboundClient is disconnected and freed.
Destroy also calls the inherited Destroy method to finalize destruction of the object instance.
procedure Execute; override;
Execute constructs the IdHeader.MsgType and the IdHeader.UserID for the OutboundClient message, and calls MasterParent.SendMsg to write the message to the tunnel connection.
When the thread is Terminated, Execute will set SelfDisconnected to True prior to exiting the method.