TsgcTURNServerEventos › OnTURNDeleteAllocation

OnTURNDeleteAllocation Evento

Gerado depois que uma Allocation foi removida, seja por refresh-to-zero do cliente ou porque seu tempo de vida expirou.

Sintaxe

property OnTURNDeleteAllocation: TsgcTURNAllocationEvent;
// TsgcTURNAllocationEvent = procedure(Sender: TObject; const aSocket: TsgcSocketConnection; const Allocation: TsgcTURNAllocationItem) of object

Valor Padrão

Observações

Disparado uma vez por desmontagem de Allocation: quando o cliente emite um REFRESH com lifetime = 0, quando o lifetime da alocação expira no timer interno do servidor, ou quando o próprio servidor é desativado (Active := False). Allocation ainda expõe o snapshot final de Username, RelayIP/RelayPort, Permissions, Channels e o último Expiry — útil para emitir registros de contabilidade, fechar painéis ou liberar recursos por usuário. aSocket pode ser nil quando a exclusão é acionada pelo timer de expiração em vez de por uma requisição do cliente. A instância de Allocation é liberada pelo servidor imediatamente após o manipulador retornar; não retenha a referência. Executa na thread do listener/timer, a menos que NotifyEvents a redirecione.

Exemplo

procedure TForm1.OnTURNDeleteAllocation(Sender: TObject;
  const aSocket: TsgcSocketConnection; const Allocation: TsgcTURNAllocationItem);
begin
  Memo1.Lines.Add(Format('Allocation deleted: user=%s relay=%s:%d',
    [Allocation.Username, Allocation.RelayIP, Allocation.RelayPort]));
end;

Voltar para Eventos