public void LoadSettings(RelayNodeDefinition node, RelayNodeGroupDefinition group) { MySpace.SocketTransport.SocketSettings newSettings = BuildSettings(group.SocketSettings); if (newSettings.SameAs(settings)) return; IDisposable disposableObject = null; try { settings = newSettings; socketClient = new SocketClient(node.IPEndPoint, settings); disposableObject = asyncSocketClient; asyncSocketClient = new AsyncSocketClient(node.IPEndPoint, new SocketPoolConfig { ReceiveTimeout = settings.ReceiveTimeout, NetworkOrdered = settings.UseNetworkOrder, ConnectTimeout = settings.ConnectTimeout, LoanCapacity = settings.PoolSize }); } finally { if (disposableObject != null) { try { asyncSocketClient.Dispose(); } catch (Exception ex) { log.Error("Failed to dispose AsyncSocketClient", ex); } } } }
public void LoadSettings(RelayNodeDefinition node, RelayNodeGroupDefinition group) { MySpace.SocketTransport.SocketSettings newSettings = BuildSettings(group.SocketSettings); if (newSettings.SameAs(settings)) { return; } IDisposable disposableObject = null; try { settings = newSettings; socketClient = new SocketClient(node.IPEndPoint, settings); disposableObject = asyncSocketClient; asyncSocketClient = new AsyncSocketClient(node.IPEndPoint, new SocketPoolConfig { ReceiveTimeout = settings.ReceiveTimeout, NetworkOrdered = settings.UseNetworkOrder, ConnectTimeout = settings.ConnectTimeout, LoanCapacity = settings.PoolSize }); } finally { if (disposableObject != null) { try { asyncSocketClient.Dispose(); } catch (Exception ex) { log.Error("Failed to dispose AsyncSocketClient", ex); } } } }