} // GetSocket internal void ReturnSocket(SocketHandler socket) { TimeSpan socketActiveTime = DateTime.UtcNow - socket.CreationTime; bool closeSocket = false; lock (this) { // Check if socket active time has exceeded the lifetime // If it has just close the Socket if (_socketCachePolicy != SocketCachePolicy.AbsoluteTimeout || socketActiveTime < _socketLifetime) { // Ignore duplicate entries for the same socket handler for (CachedSocket curr = _socketList; curr != null; curr = curr.Next) { if (socket == curr.Handler) { return; } } _socketList = new CachedSocket(socket, _socketList); _socketCount++; } else { closeSocket = true; } } if (closeSocket) { socket.Close(); } } // ReturnSocket
internal void ReturnSocket(SocketHandler socket) { TimeSpan span = (TimeSpan) (DateTime.UtcNow - socket.CreationTime); bool flag = false; lock (this) { if ((this._socketCachePolicy != SocketCachePolicy.AbsoluteTimeout) || (span < this._socketLifetime)) { for (CachedSocket socket2 = this._socketList; socket2 != null; socket2 = socket2.Next) { if (socket == socket2.Handler) { return; } } this._socketList = new CachedSocket(socket, this._socketList); this._socketCount++; } else { flag = true; } } if (flag) { socket.Close(); } }
public void ReleaseSocket(string machinePortAndSid, SocketHandler socket) { RemoteConnection connection = (RemoteConnection) _connections[machinePortAndSid]; if (connection != null) { connection.ReleaseSocket(socket); } else { socket.Close(); } }
public void ReleaseSocket(string machinePortAndSid, SocketHandler socket) { RemoteConnection connection = (RemoteConnection)_connections[machinePortAndSid]; if (connection != null) { connection.ReleaseSocket(socket); } else { socket.Close(); } }
} // GetSocket public void ReleaseSocket(String machinePortAndSid, SocketHandler socket) { RemoteConnection connection = (RemoteConnection)_connections[machinePortAndSid]; if (connection != null) { connection.ReleaseSocket(socket); } else { // there should have been a connection, so let's just close // this socket. socket.Close(); } } // ReleaseSocket
} // GetSocket public void ReleaseSocket(String machineAndPort, SocketHandler socket) { RemoteConnection connection = (RemoteConnection)_connections[machineAndPort]; if (connection != null) { connection.ReleaseSocket(socket); } else { // there should have been a connection, so let's just close // this socket. socket.Close(); } } // ReleaseSocket
} // GetSocket internal void ReturnSocket(SocketHandler socket) { TimeSpan socketActiveTime = DateTime.UtcNow - socket.CreationTime; bool closeSocket = false; lock (this) { // Check if socket active time has exceeded the lifetime // If it has just close the Socket if (_socketCachePolicy != SocketCachePolicy.AbsoluteTimeout || socketActiveTime < _socketLifetime) { // Ignore duplicate entries for the same socket handler for (CachedSocket curr = _socketList; curr != null; curr = curr.Next){ if (socket == curr.Handler) return; } _socketList = new CachedSocket(socket, _socketList); _socketCount++; } else { closeSocket = true; } } if(closeSocket) { socket.Close(); } } // ReturnSocket