/// <inheritdoc /> public override async Task Disconnect(CancellationToken cancellationToken) { if (!Connected) { return; } try { await Task.Factory.StartNew(() => { try { client.RfcQuit("Mr. Stark, I don't feel so good...", Priority.Critical); // priocritical otherwise it wont go through } catch (Exception e) { Logger.LogWarning("Error quitting IRC: {0}", e); } }, cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current).ConfigureAwait(false); Dispose(); await listenTask.ConfigureAwait(false); } catch (OperationCanceledException) { throw; } catch (Exception e) { Logger.LogWarning("Error disconnecting from IRC! Exception: {0}", e); } }
/// <inheritdoc /> public void Disconnect() { try { lock (IRCLock) { if (irc.IsConnected) { irc.RfcQuit("Twas meant to be..."); irc.Disconnect(); } } } catch { } }
/// <summary> /// Trennt die Verbindung zum Server /// </summary> public void Disconnect() { Connected = false; if (_connection != null) { if (_connection.IsConnected) { try { _connection.RfcQuit(Settings.QuitMessage); _connection.Disconnect(); } catch (NotConnectedException) { } Log.Information("Verbindung zu Server {ServerAddress} getrennt", Settings.Address); } _connection = null; } }