private TurnMessage ProcessSendRequest(Allocation allocation, TurnMessage request, ref ServerAsyncEventArgs e)
{
try
{
if (allocation == null)
throw new TurnServerException(ErrorCode.NoBinding);
if (request.Data == null || request.DestinationAddress == null)
throw new TurnServerException(ErrorCode.BadRequest);
allocation.Permissions.Permit(request.DestinationAddress.IpEndPoint);
e.LocalEndPoint = allocation.Alocated;
e.RemoteEndPoint = request.DestinationAddress.IpEndPoint;
e.Offset = request.Data.ValueRefOffset;
e.Count = request.Data.ValueRefLength;
e.ConnectionId = ServerAsyncEventArgs.AnyNewConnectionId;
peerServer.SendAsync(e);
e = null;
}
catch (Exception ex)
{
logger.WriteWarning(ex.ToString());
}
// [MS-TURN] The server MUST NOT respond to a client with either
// a Send response or a Send error response.
return null;
}