private void ProxyConnectionOnClosed(ProxyTcpConnection connection) { if (_openConnections.Contains(connection)) { _openConnections.Remove(connection); } OnConnectionClosed(); }
protected override TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket) { try { // Attempt to connect end point TcpClient client = new TcpClient(); client.Connect(ProxyEndPoint); // Setup the proxying threads ProxyTcpConnection proxyTcpConnection = new ProxyTcpConnection(client, socket); return(proxyTcpConnection); } catch (Exception e) { Logger.Error( "Failed to connect to proxy endpoint [" + ProxyEndPoint + "], cannot proxy : " + e.Message, e); return(null); } }
protected override TcpTransportConnection ProcessConnect(ITcpOverUdptSocket socket) { try { // Attempt to connect end point TcpClient client = new TcpClient(); client.Connect(ProxyEndPoint); // Setup the proxying threads ProxyTcpConnection proxyTcpConnection = new ProxyTcpConnection(client, socket); return proxyTcpConnection; } catch (Exception e) { Logger.Error( "Failed to connect to proxy endpoint [" + ProxyEndPoint + "], cannot proxy : " + e.Message, e); return null; } }
private void ProcessConnection() { TcpClient client = this._listener.AcceptTcpClient(); Logger.Debug("Client connected from " + client.Client.LocalEndPoint); try { ITcpOverUdptSocket socket = _transportManager.TCPTransport.OpenConnection(Name); ProxyTcpConnection proxyTcpConnection = new ProxyTcpConnection(client, socket); proxyTcpConnection.CloseConnection += delegate { ProxyConnectionOnClosed(proxyTcpConnection); }; _openConnections.Add(proxyTcpConnection); OnConnectionAccepted(); } catch (Exception e) { Logger.Error("Failed to connect to named endpoint " + Name + " : " + e.Message); client.Close(); } }