TsgcTURNServer › Events › OnTURNMessageDiscarded
Raised when a TURN message received by the server is discarded before any response is produced.
property OnTURNMessageDiscarded: TsgcTURNMessageDiscardedEvent;
// TsgcTURNMessageDiscardedEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; aMethod: TsgcStunMessageMethod; const aMessage: TsgcSTUN_Message; const aReason: string) of object
—
Fired when the server drops an incoming STUN/TURN message without sending back a response or an error. aMethod identifies the method (Allocate, Refresh, CreatePermission, ChannelBind, Send, Data) that was detected in the header, aMessage exposes the parsed STUN message and aReason describes why the datagram was discarded — typical causes include missing allocation for Send indications, no permission installed for the peer addressed by XOR-PEER-ADDRESS, malformed header, unsupported method, or rate-limited source. Use the event for diagnostics and intrusion detection; unlike OnSTUNRequestError this event fires for the RFC-silent discard path where no reply is ever produced. Runs on the listener thread unless NotifyEvents redirects it.
procedure TForm1.OnTURNMessageDiscarded(Sender: TObject;
const aSocket: TsgcSocketConnection; aMethod: TsgcStunMessageMethod;
const aMessage: TsgcSTUN_Message; const aReason: string);
begin
Memo1.Lines.Add(Format('TURN message dropped from %s: %s',
[aSocket.PeerIP, aReason]));
end;