private void ProcessDataPacket(StandardTcpDataPacket packet)
{
try
{
TcpConnectionHolder conn = _tcpConnections.GetRemoteConnection(packet.ConnectionId);
// If the connect response ack packet was lost, its possible that this connection is not open, we need to open it now
if (!conn.Connection.Established)
{
Logger.Debug("Outgoing Connection [" + conn.Connection.ConnectionId + "] received data, means our connect rs ack was lost, auto opening");
conn.Connection.Open();
}
// Lock receiving while we process this packet (we will still be able to send)
// Now TcpConnection doesn't have to be threadsafe, but each connection
// can process data independently at full speed.
lock (conn.ReceiveLock)
{
// now process the dataPacket;
conn.Connection.ProcessDataPacket(packet);
}
}
catch (ConnectionException e)
{
Logger.Error("Dropping data packet [" + packet + "], failed to get a connection : " + e.Message);
}
}