/// <summary> /// Closes the connection. /// </summary> /// <returns></returns> public async Task CloseAsync() { if (this.isDisposed || this.State == XmppTransportState.Closed || this.State == XmppTransportState.Closing) { return; } try { await SoftCloseAsync().ConfigureAwait(false); } catch { } finally { this.DisposeSubscriptions(); this.transport = null; this.saslMechanism = null; this.connectionString = null; this.userAddress = null; this.people = null; this.activity = null; this.capabilities = null; this.personalEventing = null; this.presence = null; this.serverCapabilities = null; this.serverFeatures = ServerFeatures.None; this.ReleaseSubjects(); } }
private void Load(string connectionString) { if (connectionString != null) { return; } string[] keyPairs = connectionString.Split(';'); this.options.Clear(); foreach (string keyPair in keyPairs) { string[] values = keyPair.Split('='); if (values.Length == 2 && values[0] != null && values[0].Length > 0 && values[1] != null && values[1].Length > 0) { values[0] = values[0].ToLower(); if (XmppConnectionString.IsSynonym(values[0])) { this.options[XmppConnectionString.GetSynonym(values[0])] = values[1].Trim(); } } } }
/// <summary> /// Disposes the specified disposing. /// </summary> /// <param name="disposing">if set to <c>true</c> [disposing].</param> private void Dispose(bool disposing) { if (!this.isDisposed) { if (disposing) { // Release managed resources here this.CloseAsync().GetAwaiter().GetResult(); } // Call the appropriate methods to clean up // unmanaged resources here. // If disposing is false, // only the following code is executed. this.connectionString = null; this.userAddress = null; this.saslMechanism = null; this.people = null; this.activity = null; this.capabilities = null; this.personalEventing = null; this.presence = null; this.serverCapabilities = null; this.serverFeatures = ServerFeatures.None; this.state = XmppTransportState.Closed; this.CloseTransport(); this.DisposeSubscriptions(); this.ReleaseSubjects(); } this.isDisposed = true; }