Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

methodtMailChannel.StartTLS

function StartTLS(aDeadline: UInt64; out aError: string): Boolean;
The server side of the in-band upgrade. Call it AFTER the success reply has been written in cleartext - the 220 to STARTTLS, the +OK to STLS. True = the channel is now encrypted; False = it is dead, and the caller must close rather than fall back to cleartext.

aDeadline IS THE WHOLE-SESSION BUDGET, in GetTickCount64 terms, and High(UInt64) means unbounded. IT HAS TO BE PASSED IN because a handshake does not go round the driver's read loop, which is where that budget is otherwise tested: without it the real bound on a thread stuck here is cMailHandshakeRounds x cMailHandshakeTimeoutMs = 32 minutes, longer than every session budget in this family, and MaxConnections peers each starting an upgrade they never finish is a listener that is full for half an hour with the limit meant to stop it never running.