re-arm, close
Feature notes: TLS implementation notes (RFC map) · Async TLS socket server architecture
One multiplexer event in platform-neutral form. The backend's WaitEvents translates its native struct into this; Generation is the value the backend carried through the kernel with the registration (see tPollSlot).
Fd: TSocketHandle;
Generation: Cardinal;
Wake: Boolean;
CanRead: Boolean;
CanWrite: Boolean;
Failed: Boolean;
Fd: TSocketHandle;
Generation: Cardinal;
Conn: tReactorConnection;
Endpoint: tReactorDatagramEndpoint;
Hold: IInterface;
ReadArmed: Boolean;
SendBuf: PByte;
SendLen: Integer;
SendPos: Integer;
NextBuf: PByte;
NextLen: Integer;
HasNext: Boolean;
InDrain: Boolean;
(no public members)
(no public members)
inherits from TThread
constructor Create(aReactor: tPollReactor);
inherits from tAsyncReactor
constructor Create(aThreadCount: Integer); override;
destructor Destroy; override;
procedure Start; override;
procedure Stop; override;
procedure CloseSocketHandle(aHandle: TSocketHandle); override;
procedure Attach(aConnection: tReactorConnection); override;
procedure Detach(aConnection: tReactorConnection); override;
function SupportsApplicationWork: Boolean; override;
function PostReceive(aConnection: tReactorConnection): Boolean; override;
function PostSend(aConnection: tReactorConnection; aData: Pointer; aLen: Integer): Boolean; override;
function Nudge(aConnection: tReactorConnection): Boolean; override;
function ConnectionCount: Integer; override;
function SnapshotConnections(out aConns: TArray<tReactorConnection>; out aHold: TArray<IInterface>): Integer; override;
function SupportsDatagrams: Boolean; override;
procedure AttachDatagram(aEndpoint: tReactorDatagramEndpoint); override;
procedure DetachDatagram(aEndpoint: tReactorDatagramEndpoint); override;
function SendDatagram(aEndpoint: tReactorDatagramEndpoint; aData: Pointer; aLen: Integer; const aTo: tSocketAddress; out aError: Integer): Boolean; override;
function SetDatagramEcnReception(aEndpoint: tReactorDatagramEndpoint; aEnabled: Boolean; out aError: Integer): Boolean; override;
function SendDatagramEcn(aEndpoint: tReactorDatagramEndpoint; aData: Pointer; aLen: Integer; const aTo: tSocketAddress; aEcn: tDatagramEcn; out aError: Integer): Boolean; override;
function DatagramEndpointCount: Integer; override;
property DrainReceive: Boolean read fDrainReceive write fDrainReceive;
Per-fd state, indexed by the descriptor and recycled with it. Allocated once per fd and never moved, so the address is stable, but NOT freed on detach - a stale event naming this fd must still find a valid record to be rejected by. Generation is what rejects it: it is bumped on every attach AND detach, and the kernel hands it back with the event, so an event minted for an earlier owner of a reused descriptor cannot be delivered to the current one.
LOCKING: Conn/Hold/Generation are written under the reactor's fSlotLock. Everything below them belongs to the connection and is touched ONLY under that connection's gate (tReactorConnection.Enter).