public void TestSessionEnd(TestSessionEndArgs testSessionEndArgs) { Log($"TestSession ends."); _client?.Dispose(); _client = null; _server.RaiseNewClientEvent -= ConnectionEstablished; }
private void OnConnect(IAsyncResult ar) { CommunicationChannel session = null; lock (_lck) { try { _listener.EndWaitForConnection(ar); } catch (IOException) { return; } if (_mustShutdown) { return; } if (_listener.IsConnected) { session = new CommunicationChannel(_listener, $"S({_channels.Count}):[{PipeName}])"); session.SetLogger(OutputToLog); Log($"New connection."); _channels.Add(session); _listener = null; session.RaiseReceivedMessage += Session_RaiseReceivedMessage; } Listen(); } RaiseNewClientEvent?.Invoke(this, new ConnectionEventArgs(session)); session.Start(); }
private void ConnectionEstablished(object s, ConnectionEventArgs e) { lock (_lck) { _client = e.Client; _client.RaiseReceivedMessage += ReceivedMutant; Monitor.Pulse(_lck); } }
public ConnectionEventArgs(CommunicationChannel client) { this.Client = client; }