public void Dispose() { var cs = Client.ShutdownAsync(); var ss = Server.ShutdownAsync(); while (!cs.Wait(5000)) { Console.WriteLine(" *** Waiting for client shutdown call"); } while (!ss.Wait(5000)) { Console.WriteLine(" *** Waiting for server shutdown call"); } var allt = Task.WhenAll( cs, ss, ServerTask, ClientTask ); while (!allt.Wait(5000)) { Console.WriteLine(" *** Hung for 5s on shutdown ..."); } }
/// <summary> /// Shutdowns the connection. /// </summary> /// <returns>An awaitable task.</returns> public Task ShutdownAsync() { return(m_connection.ShutdownAsync()); }