Feature notes: TLS implementation notes (RFC map) · Async TLS socket server architecture
inherits from Exception
(no public members)
Optional transport companion (Supports on the iAppTransport) for a session that must act without new input from the peer: resume paused work, or enforce a timeout of its own. RequestWork asks for one call of the session's iAppSessionWork.WorkQueued; requests made before it runs collapse into one. False: the connection is closed, or the reactor backend cannot run application work. SetWorkDeadline asks for the same call once the absolute time aDeadline, in stTlsUtils.GetTickCount64 milliseconds, has passed; it replaces the previous deadline, 0 clears it, and the connection's handshake and idle deadlines are not touched. The deadline is cleared before each WorkQueued, so set it again there while one is still needed. If a due deadline cannot be serviced, the connection is closed.
function RequestWork: Boolean;
procedure SetWorkDeadline(aDeadline: UInt64);
Optional transport companion for a session whose limits depend on where its conversation has got to. Call it from the session's own callbacks.
SetIdleLimit replaces IdleTimeout for this connection: the milliseconds without traffic in either direction before nrIdle is raised. 0 means no idle deadline. Setting a different value starts that period now.
SetSessionBudget raises nrRequestStalled once, after aMillis, whatever traffic there is meanwhile, and replaces any budget running. 0 cancels it. Answering nvKeepAlive does not set it again: call this again if one is still needed. Neither the handshake deadline nor the idle deadline is touched.
LoadPercent is how full the server is: the larger of its live sessions against MaxLiveSessions and its handshakes against MaxConcurrentHandshakes. ServerIdleMs is the server's IdleTimeout, for a session that will not run longer than the application asked.
ExpireIdleLimit ends the idle period now: nrIdle is raised at the next sweep of the deadlines, on the usual path, and nvKeepAlive starts the period again. For a session whose own sends keep the deadline moving although its peer has said nothing: a send completing before that sweep does not put it off, and input from the peer does.
procedure SetIdleLimit(aMillis: Cardinal);
procedure SetSessionBudget(aMillis: Cardinal);
function LoadPercent: Integer;
function ServerIdleMs: Cardinal;
procedure ExpireIdleLimit;
Optional transport companion that lets a session stop reading from the peer while it cannot take more input. Call it only from the session's own callbacks. ReceiveFlowAvailable is True once the handshake is complete, when TLS compression is off and the reactor backend supports application work; otherwise PauseReceive(True) raises ETLSAsyncServer, so test it first. PauseReceive(True) stops DataReceived and EarlyDataReceived calls and the reading of the socket; a receive the backend already started still completes and its data is held. To resume, call PauseReceive(False) and then iAppTransportWork.RequestWork: the held data is delivered after that WorkQueued, and reading restarts. While available, a session that implements iAppSessionWork gets its input in pieces of at most 16 KiB, so a pause takes effect before the next piece.
function ReceiveFlowAvailable: Boolean;
procedure PauseReceive(aPaused: Boolean);
Implement on the session to receive the calls iAppTransportWork asks for. WorkQueued runs on a reactor I/O thread, serialized with the session's other callbacks, like DataReceived.
procedure WorkQueued;
function GetNegotiatedProtocol: OctetString;
function GetNegotiatedVersion: TProtocolVersion;
function GetRemoteAddress: string;
procedure Send(aData: Pointer; aLen: Integer);
procedure Close(aGraceful: Boolean);
function Instance: tObject;
function ExportKeyingMaterial(const aLabel : AnsiString; const aContext: tBytes; aLen : Integer): tBytes;
property NegotiatedProtocol: OctetString read GetNegotiatedProtocol;
property NegotiatedVersion: TProtocolVersion read GetNegotiatedVersion;
property RemoteAddress: string read GetRemoteAddress;
WHAT THE HANDSHAKE DECIDED, for an application that needs to see it: the client certificate when mTLS was used, the name the client asked for, and the algorithms in force.
REACHED BY QueryInterface ON THE TRANSPORT, not by a method on iAppTransport:
var lTLS: iTLSConnectionInfo; if Supports(aTransport,iTLSConnectionInfo,lTLS) then if lTLS.PeerCertificatePresent then ...
Same reasoning as iAppSessionNudge below. iAppTransport is a shipped contract with implementors outside this repository, so widening it would break them; a transport that does not implement this one simply answers False to Supports, which is what makes the whole mechanism additive. Every transport this unit creates does implement it.
VALID ONLY WHILE THE CONNECTION IS. It reads through to the live TLS session, so hold it no longer than you hold the transport itself, and expect every member to answer its empty value once the connection has closed.
NOTHING HERE IS A SUBSTITUTE FOR THE HANDSHAKE'S OWN DECISIONS. The peer certificate has already been verified against the trust configuration by the time a session exists - if it had not passed, there would be no connection to ask. What this interface adds is WHO it turned out to be, so an application can authorize on top of an authentication that already happened.
function GetVersion: TProtocolVersion;
function GetVersionName: string;
function GetCipherSuite: TCipherSuite;
function GetCipherSuiteName: string;
function GetServerName: string;
function GetKeyExchangeGroup: Word;
function GetKeyExchangeGroupName: string;
function GetIsResumed: Boolean;
function GetPeerCertificate: iCertificate;
function GetPeerCertificatePresent: Boolean;
property Version: TProtocolVersion read GetVersion;
property VersionName: string read GetVersionName;
property CipherSuite: TCipherSuite read GetCipherSuite;
property CipherSuiteName: string read GetCipherSuiteName;
property ServerName: string read GetServerName;
property KeyExchangeGroup: Word read GetKeyExchangeGroup;
property KeyExchangeGroupName: string read GetKeyExchangeGroupName;
property IsResumed: Boolean read GetIsResumed;
property PeerCertificate: iCertificate read GetPeerCertificate;
property PeerCertificatePresent: Boolean read GetPeerCertificatePresent;
The per-connection application session. When the handshake completes, ALPN (or the fallback policy) has picked an iAppProtocol; the connection asks it for CreateSession and from then on this is the object the reactor drives: Opened first, DataReceived for 1-RTT plaintext, EarlyDataReceived for what arrived as 0-RTT (see its contract below), Closed exactly once at the end. Callbacks run on reactor I/O threads with the connection's gate held: do the protocol work and return - never block there, and never join a thread from Closed. Instance exposes the implementing object to whoever holds the interface.
procedure Opened;
procedure DataReceived(aData: Pointer; aLen: Integer);
procedure EarlyDataReceived(aData: Pointer; aLen: Integer);
procedure Closed(aGraceful: Boolean);
function Instance: tObject;
OPTIONAL companion to iAppSession, reached by QueryInterface on the session a plugin returned from CreateSession - deliberately NOT a method ON iAppSession. That interface is a shipped contract with implementors outside this repository, so widening it would break them; a plugin that does not implement this one is simply not asked, which is what makes the whole mechanism additive. Nudged runs on an I/O thread with the connection's gate held, so it may read the session's own state directly and MUST NOT block. It answers for the protocol only - whether this connection is mid-message, mid-stream, or genuinely idle - and the application still gets the last word after it. aRearmMs is read only when the verdict is nvKeepAlive: it is how long to wait before asking again, and 0 there means "stop asking", i.e. hold this connection open until something else closes it - except after the peer's close (close_notify or FIN), where 0 is asked again every cPeerCloseGraceMs. That is the case a session waiting on an external event wants - a Snif callback that intends to answer when something finally happens keeps its transport alive by returning nvKeepAlive with aRearmMs = 0, and the connection stops being a deadline's business until the session arms one again. aRearmMs arrives holding the idle limit, except for nrRequestStalled: a session budget is not the idle deadline, so there it arrives holding what is left of the idle deadline already running (0 when none is), and nvKeepAlive with it untouched leaves that deadline where it was.
function Nudged(aReason: tNudgeReason; var aRearmMs: Cardinal): tNudgeVerdict;
HOW MUCH THE TRANSPORT WILL TAKE, for a session that sends more than a few octets at a time. OPTIONAL companion to iAppTransport, reached by QueryInterface on the transport - the same additive shape as iTLSConnectionInfo, and for the same reason: iAppTransport has implementors outside this repository. Every transport this unit creates over the reactor implements it; the plaintext redirect transport does not, and a session that finds it missing sends the way it always did.
WHY A SESSION NEEDS IT. Send never blocks and never refuses: it queues. The queue behind a send in flight is bounded by MaxSendQueueBytes, and a Send that does not fit CLOSES THE CONNECTION. Something is in flight far more often than a session can see - the server's own handshake and NewSessionTicket flight right after the handshake, the previous chunk of the same response, another HTTP/2 stream's frames - so a session that hands over a large buffer in one call, or one buffer per flow-control window, is one that gets its connection cut part-way. A session that keeps each Send within SendCredit, and sends the rest when iAppSessionDrain.Drained says there is room again, never does.
BOTH VALUES ARE A SNAPSHOT taken under the connection's gate. Inside a session callback (which already holds it) they stay true until the session itself sends; from any other thread they can be stale by the time they are read.
function GetSendCredit: Integer;
function GetSendPending: Integer;
property SendCredit: Integer read GetSendCredit;
property SendPending: Integer read GetSendPending;
Optional transport companion (Supports on the iAppTransport) that ends the connection now. Close, graceful or not, only asks for the close: the connection goes once what is queued has been sent, so a peer that has stopped reading keeps it open until a deadline reaps it, and with IdleTimeout 0 there is none. Abort discards what is queued and has the reactor tear the connection down on one of its own threads, without asking the session or OnConnectionNudge. It never takes the connection's gate and never waits for a session callback: it takes only the reactor's short internal wake-queue lock, which is never held while a connection gate is waited for. So it is safe from any thread, including one a session callback is waiting for; a callback running on the connection finishes first. On a reactor backend without an out-of-band wake the close stays requested and happens at the connection's next completion.
procedure Abort;
THE TRANSPORT HAS MADE ROOM. OPTIONAL companion to iAppSession, reached by QueryInterface on the session a plugin returned from CreateSession - like iAppSessionNudge, and for the same reason. A session that does not implement it is never called, which is what every session written before it expects.
Drained runs after EVERY completed send on an established connection that is not closing: the peer has taken a buffer, and aPending octets are still on their way (0 = everything sent so far has left). It is the other half of iAppTransportFlow: a session with more to send than SendCredit allowed sends the next part here, within the credit it reads now, and stops again when the credit runs out. Nothing else will wake it - a session that waits for credit without implementing this waits for ever.
CONTRACT: runs on an I/O thread with the connection's gate held, exactly like DataReceived. It MAY call Send and Close on its transport - that is the point - and must not block. On the POSIX reactors a completion can be reported from INSIDE a Send the session itself is making, so Drained can arrive while the session is still in the middle of sending: a session must either tolerate that or note it and carry on from its own loop. Raising from it closes the connection.
procedure Drained(aPending: Integer);
HOW EACH DIRECTION ENDS, for a session that wants to know. OPTIONAL companion to iAppSession, reached by QueryInterface on the session once, when it is created - the same additive shape as iAppSessionDrain, so iAppSession and the sessions outside this repository are unchanged.
ReceiveClosed: nothing more will be delivered. After the peer's close_notify, or a TCP half-close (FIN) without one, it comes once every octet that came before it has been delivered to DataReceived. After a FIN, or the peer's close_notify on TLS 1.3, the session may still Send - to answer what it received - and ends the connection with Close(True), which sends this side's close_notify; if it does not, it is asked again (iAppSessionNudge, OnConnectionNudge) after IdleTimeout, or after 30 seconds when IdleTimeout is 0, and the connection closes gracefully unless that answer is nvKeepAlive. After a TLS 1.2 close_notify the server answers and closes as soon as ReceiveClosed returns, and a Send from ReceiveClosed is dropped (RFC 5246 sec.7.2.1). On a fatal alert, or when the connection is torn down, it comes together with SendClosed, and data still parked for a paused session is discarded undelivered. SendClosed: this side can send nothing more. This side's close_notify went out (also from inside the session's own Close), a fatal alert was sent or received, or the connection is being torn down. A Send after it is dropped. Each is called at most once, and both come before iAppSession.Closed, which is still the final call: the session detaches there. A session that does not implement this interface is told nothing new, and a FIN ends its connection at once, as before.
CONTRACT: runs on an I/O thread with the connection's gate held, like DataReceived. It may call Send and Close and must not block. Raising from it closes the connection.
procedure ReceiveClosed;
procedure SendClosed;
OPTIONAL companion to iAppProtocol, reached by QueryInterface on the protocol the registry resolved - the same additive shape as iAppSessionNudge above, and for the same reason: iAppProtocol has implementors outside this repository.
A PLAINTEXT REDIRECT IS NOT A SESSION, which is why this is one method and not a second iAppSession. The exchange is a single short request followed by a single short response and then a close: there is no handshake, no negotiated protocol, no keep-alive, nothing to nudge, and nothing that can outlive the answer. Giving it Opened/Closed/Nudged would be inventing a lifecycle for something that has none.
aData is the bytes read from the peer in one go, and is NOT guaranteed to be a complete request - the implementor decides what it has and answers, or answers with an error. It must not block: the caller is a short-lived thread holding one of a bounded number of slots.
WHO IS ASKED is not a new concept either. The connection carries no ALPN, so the server resolves it exactly as it resolves a TLS client that offered none: ResolveProtocol('') applies FallbackPolicy, with AlpnPriority ordering the candidates. A deployment that wants HTTP/1.1 to answer plaintext while HTTP/2 wins ALPN therefore sets AlpnPriority high on the h2 plugin and marks the HTTP/1.1 plugin IsFallbackProtocol - no separate selection knob.
procedure DataReceived(aData: Pointer; aLen: Integer);
function GetToken: OctetString;
function GetDescription: string;
function CreateSession(const aTransport: iAppTransport): iAppSession;
property Token: OctetString read GetToken;
property Description: string read GetDescription;
function GetCount: Integer;
function GetProtocol(aIndex: Integer): iAppProtocol;
function GetFallbackProtocol: iAppProtocol;
procedure SetFallbackProtocol(const Value: iAppProtocol);
function GetFallbackPolicy: tFallbackPolicy;
procedure SetFallbackPolicy(const Value: tFallbackPolicy);
procedure AddProtocol(const aProtocol: iAppProtocol);
function RemoveProtocol(const aProtocol: iAppProtocol): Boolean;
function FindProtocol(const aToken: OctetString): iAppProtocol;
function AdvertisedProtocols: TApplicationProtocols;
function ResolveProtocol(const aNegotiated: OctetString): iAppProtocol;
property Count: Integer read GetCount;
property Protocols[aIndex: Integer]: iAppProtocol read GetProtocol;
property FallbackProtocol: iAppProtocol read GetFallbackProtocol write SetFallbackProtocol;
property FallbackPolicy: tFallbackPolicy read GetFallbackPolicy write SetFallbackPolicy;
OPTIONAL companion to iAppProtocolRegistry, reached by QueryInterface on TsmAsyncTLSServer.Protocols - deliberately NOT a method on that interface, which is a shipped contract with implementors outside this repository. A registry that does not implement this one is simply not asked, and the caller falls back to the plain append.
procedure AddProtocolByPriority(const aProtocol: iAppProtocol; aPriority: Integer);
function ProtocolPriority(const aToken: OctetString): Integer;
(no public members)
(no public members)
Kind: tProvisionKind;
FileName: TFileName;
Password: iSecretKey;
THE REGISTRY IS READ FROM REACTOR THREADS AND WRITTEN FROM THE APPLICATION THREAD, so every public entry point takes fLock.
fList locks its own individual operations, but that is not enough: the list and fPriorities are TWO structures holding ONE fact, and the composite operations (scan, then Insert + PriorityInsert; IndexOf, then Delete + PriorityDelete) are what must be atomic. A reader walking the list while PriorityDelete shifts the array underneath it sees priorities belonging to the wrong protocols, or indexes past the end.
The public/Core split exists because the lock is NOT assumed re-entrant - TCriticalSection is recursive on Windows but that is not a promise this unit relies on, and the POSIX reactors compile the same code. AddProtocol delegates to AddProtocolByPriority and ResolveProtocol to FindProtocol, so each takes the lock once and calls the unlocked Core.
HELD ACROSS iAppProtocol.Token, which is a call OUT to the plugin: our own adapters read one field, but a foreign implementation must not call back into this registry from GetToken or it will deadlock against itself.
Count and Protocols[] are individually safe but not atomic AS A PAIR - a "for i := 0 to Count - 1" walk can still race a concurrent removal, which is why GetProtocol answers nil out of range instead of raising, and why AdvertisedProtocols (one locked snapshot) is what the handshake path actually uses.
constructor Create;
destructor Destroy; override;
procedure AddProtocol(const aProtocol: iAppProtocol);
procedure AddProtocolByPriority(const aProtocol: iAppProtocol; aPriority: Integer);
function ProtocolPriority(const aToken: OctetString): Integer;
function RemoveProtocol(const aProtocol: iAppProtocol): Boolean;
function FindProtocol(const aToken: OctetString): iAppProtocol;
function AdvertisedProtocols: TApplicationProtocols;
function ResolveProtocol(const aNegotiated: OctetString): iAppProtocol;
constructor Create(aMaxHandshakes, aMaxSessions: Integer);
destructor Destroy; override;
function Admit: tAdmissionVerdict;
procedure HandshakeCompleted(aSuccess: Boolean);
procedure SessionClosed;
property MaxHandshakes: Integer read fMaxHandshakes write fMaxHandshakes;
property MaxSessions: Integer read fMaxSessions write fMaxSessions;
property ActiveHandshakes: Integer read fActiveHandshakes;
property ActiveSessions: Integer read fActiveSessions;
procedure SendCompleted(aByteLen: Integer); override;
function ReceiveEnded: Boolean; override;
constructor Create(aServer: TsmAsyncTLSServer; aHandle: TSocketHandle; const aRemoteAddress: string; aEngineIndex: Integer);
destructor Destroy; override;
procedure ArmDeadline(aMillis: Cardinal);
procedure CancelDeadline;
function CheckDeadline(aNow: UInt64): Boolean;
function DeadlineExpired(aNow: UInt64): Boolean;
function RequestNudgeFor(aReason: tNudgeReason): Boolean;
property Deadline: Int64 read ReadDeadline;
property Admitted: Boolean read fAdmitted write fAdmitted;
property Engine: TsmSimpleTLSInternalServer read fEngine;
property ContentLayer: TCustomTLS_ContentLayer read fContentLayer;
property Session: iAppSession read fSession;
property Protocol: iAppProtocol read fProtocol;
inherits from TThread
THE CLOCK. One thread per active server, parked on an event with a timeout - the same shape tRenewalThread uses for ACME renewal, and deliberately NOT a tick hosted on the reactor's I/O threads: a plugin callback runs INLINE on the thread that delivered its bytes, so a blocking handler parks an I/O thread, and a timer living there would stop firing under exactly the load that makes reaping matter. Worse, any application handler that blocks is reachable by a normal request, which would hand a peer a way to switch the reaper off. It does no work of its own beyond comparing integers: for each connection it asks CheckDeadline, and a connection that has expired raises a NUDGE. The decision and the close then happen on that connection's own I/O thread, under its gate (see tTLSConnection.DoNudge), so this thread never takes a per-connection lock and never touches a content layer.
constructor Create(aServer: TsmAsyncTLSServer);
destructor Destroy; override;
procedure Poke;
inherits from TThread
The ONE accept-loop thread. It does not own the listening socket: the component binds and listens BEFORE this thread exists (so a bind failure raises synchronously out of 'Active := True' rather than dying silently on a background thread), and stops it from the outside to end the loop.
constructor Create(aServer: TsmAsyncTLSServer; aSocket: tTLSListenerSocket);
inherits from TPersistent
TOCSPOptions is the configuration TEMPLATE for the per-shard OCSP responders, the same way TTLSOptions is the template for the per-shard TLS options.
WHY A TEMPLATE AND NOT ONE SHARED TsmOcsp: a responder's TrustedCertificates binds to exactly ONE RootCerts store, so a single instance handed to N engines would end up bound to the last one and the other N-1 would validate against a store that is not theirs. Worse, each engine guards its responder with its OWN FOcspLock, so a shared instance would be raced by N unrelated locks - exactly the hazard that lock was added to remove. DoActivate therefore mints one TsmOcsp per shard from this template and binds each to its own RootCerts.
constructor Create(aOwner: TComponent);
procedure AssignTo(Dest: TPersistent); override;
procedure ApplyTo(aOcsp: TsmOcsp);
property Enabled: Boolean read fEnabled write fEnabled default False;
property ResponderURL: string read fResponderURL write fResponderURL;
property Timeout: Cardinal read fTimeout write fTimeout default 15000;
property MaxClockSkew: Cardinal read fMaxClockSkew write fMaxClockSkew default 300;
property RequireSignatureCheck: Boolean read fRequireSignatureCheck write fRequireSignatureCheck default True;
property Nonce: Boolean read fNonce write fNonce default True;
property RequireNonce: Boolean read fRequireNonce write fRequireNonce default False;
property NonceLength: Integer read fNonceLength write fNonceLength default 16;
property LightweightMode: Boolean read fLightweightMode write fLightweightMode default False;
inherits from TComponent
implements iAcmeAlpnTLS, iKeyAndCertStore
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function PeerConnections(const aPeer: string): Integer;
function AddCertificate(const aCert: iCertificate; aExplicitTrust: Boolean; var aStatus: TCertStatusCode; aAllowExpired: Boolean = False; aAllowDuplicateKeyIdentifier: Boolean = False): Boolean;
function AddLocalCertificate(const aCert: iCertificate; var aStatus: TCertStatusCode; aAllowExpired: Boolean = False; aAllowDuplicateKeyIdentifier: Boolean = False): Boolean;
function AddCRL(const aCRL: iCertificateList; var aStatus: TCertStatusCode): Boolean;
procedure ClearExpiredSessionKeys(aConservative: Boolean = True);
procedure ImportFromPFX(aFileName: TFileName; aPassword: iSecretKey);
procedure LoadRootCertsFromFile(aFileName: TFileName);
procedure ValidatePublicKeyPairs;
function TryBeginAcmeChallenge: Boolean;
procedure EndAcmeChallenge;
procedure ProvisionAcmeChallenge(aKey: TComponent; const aIdentifier, aKeyAuthorization: string);
procedure RemoveTLSAcmeALPN;
procedure AddTLSAcmeALPN(const aPriv: iMPPrivateKey; const aHostName: string; const aAuthorization: tBytes);
function AcmeAddCACertificate(const aCert: iCertificate; var aStatus: TCertStatusCode): Boolean;
procedure ReplaceTLSServerCertificate(const aCert: iCertificate; const aPriv: iMPPrivateKey); overload;
procedure ReplaceTLSServerCertificate(const aCert: iCertificate; const aPriv: iMPPrivateKey; const aRetired: array of iCertificate); overload;
procedure Deactivate(aKill: Boolean);
property Reactor: tAsyncReactor read fReactor;
property Admission: tTLSAdmissionController read fAdmission;
property Filter: iPeerFilter read fFilter write fFilter;
property OnPeerRefused: tAsyncTLSPeerRefusedEvent read fOnPeerRefused write fOnPeerRefused;
procedure ReportPeerActivity(const aPeer: string; aUnits: Integer = 1);
property Protocols: iAppProtocolRegistry read fRegistry;
property TicketStore: iTls13TicketStore read fTicketStore write fTicketStore;
property DriveHighWater: Integer read fDriveHighWater;
property DriveWidenMs: Integer read fDriveWidenMs write fDriveWidenMs;
property BoundPort: Word read GetBoundPort;
property BindIP: string read fBindIP write fBindIP;
property BindPort: Word read fBindPort write fBindPort default 443;
property PlainTextRedirectPort: Word read fPlainPort write SetPlainPort default 0;
property Active: Boolean read fActive write SetActive default False;
property IOThreadCount: Integer read fIOThreadCount write fIOThreadCount default 0;
property EngineCount: Integer read fEngineCount write fEngineCount default 0;
property UseDirectLayer: Boolean read fUseDirectLayer write fUseDirectLayer default True;
property SharedTicketStore: Boolean read fSharedTicketStore write fSharedTicketStore default False;
property MaxConcurrentHandshakes: Integer read fMaxHandshakes write fMaxHandshakes default 256;
property MaxLiveSessions: Integer read fMaxSessions write fMaxSessions default 8192;
property MaxConnectionsPerPeer: Integer read fMaxConnectionsPerPeer write fMaxConnectionsPerPeer default 0;
property FallbackPolicy: tFallbackPolicy read fFallbackPolicy write SetFallbackPolicy default fbpRefuse;
property DeactivateTimeout: Cardinal read fDeactivateTimeout write fDeactivateTimeout default 30000;
property HandshakeTimeout: Cardinal read fHandshakeTimeout write fHandshakeTimeout default 15000;
property IdleTimeout: Cardinal read fIdleTimeout write fIdleTimeout default 0;
property MaxSendQueueBytes: Integer read fMaxSendQueueBytes write fMaxSendQueueBytes default cDefaultMaxSendQueue;
property OcspOptions: TOCSPOptions read fOcspOptions write SetOcspOptions;
property OnConfigureEngine: tConfigureEngineEvent read fOnConfigureEngine write fOnConfigureEngine;
property OnTLSIncomingAlert: TTLSAlertEvent read fOnIncomingAlert write fOnIncomingAlert;
property OnTLSOutgoingAlert: TTLSAlertEvent read fOnOutgoingAlert write fOnOutgoingAlert;
property OnHandshakeDone: tAsyncTLSConnectionEvent read fOnHandshakeDone write fOnHandshakeDone;
property OnConnectionClosed: tAsyncTLSConnectionEvent read fOnConnectionClosed write fOnConnectionClosed;
property OnProtocolSelect: tAsyncTLSProtocolSelectEvent read fOnProtocolSelect write fOnProtocolSelect;
property OnConnectionNudge: tAsyncTLSNudgeEvent read fOnConnectionNudge write fOnConnectionNudge;
property OnSendQueueOverflow: tAsyncTLSSendOverflowEvent read fOnSendQueueOverflow write fOnSendQueueOverflow;
Why a connection is being asked whether it should still exist. Separate values rather than one "idle" because the layers that answer want to tell them apart: a handshake that never finished, a request that stopped arriving and a keep-alive connection between requests are not the same connection and do not deserve the same answer. nrRequestStalled is raised when the budget a session set with iAppTransportDeadlines.SetSessionBudget runs out.
The answer. nvClose is the default at every layer: a deadline that expires by being ignored is not a deadline.
Fired when the peer screen turned a connection away at accept. Informational: the descriptor is already closed and nothing was sent.
Fired before a nudged connection is closed - see OnConnectionNudge. aVerdict arrives carrying the protocol plugin's own answer (nvClose when the plugin did not implement iAppSessionNudge), so a handler that leaves it alone defers to the plugin.
Fired when MaxSendQueueBytes refused a buffer and the connection is being closed for it - see OnSendQueueOverflow. aQueued and aInFlight are the backlog it did not fit behind, aRefused the buffer that was dropped.
Fired once per engine at activation (on the activating thread) so the app can load the identity + options into EACH sharded engine.
ONE RECORDED PROVISIONING CALL, replayed when the engine bank exists. The engines are built inside activation, so a call that provisions the bank can only be performed once there is a bank. Recording it instead is what lets an application state its certificates in the ordinary place - beside the port and the routes, before Active := True - and have them applied at the first moment there is somewhere to put them. ONE QUEUE, NOT ONE PER OPERATION, because the ORDER is load-bearing: importing a leaf before its issuer is in the store leaves the chain incomplete, and an application says so by calling LoadRootCertsFromFile first. Replaying by category would discard exactly that.