Example #1
0
        /// <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();
            }
        }
Example #2
0
        /// <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;
        }
Example #3
0
 internal void RequestTransportInitialization()
 {
     this.subscriptions      = new ConcurrentDictionary <string, CompositeDisposable>();
     this.people             = new ContactList();
     this.activity           = new Activity();
     this.capabilities       = new ClientCapabilities();
     this.personalEventing   = new PersonalEventing();
     this.presence           = new XmppTransportPresence();
     this.Configuration      = new XmppTransportConfiguration();
     this.serverCapabilities = new EntityCapabilities();
 }