private void TurnServer_PeerDataReceived(ref ServerAsyncEventArgs e)
{
//lock (syncRoot)
{
try
{
Allocation allocation = allocations.GetByPeer(e.LocalEndPoint, e.RemoteEndPoint);
if (allocation != null)
{
allocation.TouchLifetime();
if (allocation.IsActiveDestinationEnabled)
{
e.LocalEndPoint = allocation.Alocated;
e.RemoteEndPoint = allocation.ActiveDestination;
e.Count = e.BytesTransferred;
e.ConnectionId = ServerAsyncEventArgs.AnyNewConnectionId;
peerServer.SendAsync(e);
e = null;
}
}
}
catch (Exception ex)
{
logger.WriteWarning(ex.ToString());
}
}
}