TsgcTURNServerEvents › OnTURNMessageDiscarded

OnTURNMessageDiscarded 事件

当服务器收到的 TURN 消息在产生任何响应之前被丢弃时触发。

语法

property OnTURNMessageDiscarded: TsgcTURNMessageDiscardedEvent;
// TsgcTURNMessageDiscardedEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; aMethod: TsgcStunMessageMethod; const aMessage: TsgcSTUN_Message; const aReason: string) of object

默认值

备注

当服务器丢弃传入的 STUN/TURN 消息而不发回响应或错误时触发。aMethod 标识头部中检测到的方法(Allocate、Refresh、CreatePermission、ChannelBind、Send、Data),aMessage 公开解析后的 STUN 消息,aReason 描述了丢弃数据报的原因,典型原因包括 Send indication 没有对应的分配、XOR-PEER-ADDRESS 指定的对等方没有安装权限、头部格式错误、不支持的方法或源地址被速率限制。使用此事件进行诊断和入侵检测;与 OnSTUNRequestError 不同,此事件针对 RFC 中静默丢弃路径触发,从不产生回复。在监听器线程上运行,除非 NotifyEvents 将其重定向。

示例

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;

返回事件