internal void Stop(ConnectionLossType cause)
        {
            if (stopping)
            {
                return;
            }
            else
            {
                stopping = true;
            }

            ConnectionToken?.Cancel();
            lastConnectionTestStopwatch?.Stop();
            pollingService?.Change(-1, -1);
            connectionStatusService?.Change(-1, -1);
            if (connection.ConnectionState == ConnectionState.Connected)
            {
                Send(Protocol.Connection_Close);
                Send(Protocol.Connection_Close);
            }

            connection.UnInitialize();
            ConnectionClosed?.Invoke(cause);
            connection.ConnectionState = ConnectionState.Offline;
        }
Пример #2
0
 private static void WriteDisconnect(ConnectionLossType x)
 {
     Console.WriteLine("Disconnected: " + x.ToString());
 }