public void Dispose()
 {
     Channel.Abort();
     Connection.Abort();
     Channel.Dispose();
     Connection.Dispose();
 }
Exemple #2
0
 public void Close()
 {
     if (Channel.State != CommunicationState.Closed)
     {
         Channel.Abort();
         Channel.Close();
     }
 }
Exemple #3
0
        //void Maintain(object sender)
        //{
        //    var delay = DateTime.Now - LastUpdate;
        //    if (delay > MaxUpdateOfflineDelay)
        //    {
        //        // server didn't react in a long time -> Consider it offline
        //        Flags = RealmFlags.Offline;

        //        if (delay > MaxUpdateDeadDelay)
        //        {
        //            SetOffline();
        //        }
        //    }
        //}

        /// <summary>
        /// Disconnects the given Realm and flags it as offline, or removes it from the RealmList entirely.
        /// Also removes all logged in accounts.
        /// </summary>
        /// <param name="remove">Whether to remove it entirely (true) or only show as offline (false)</param>
        public void Disconnect(bool remove)
        {
            if (Channel != null)
            {
                Channel.Abort();
            }
            SetOffline(remove);
        }
Exemple #4
0
        private void teardownConnection()
        {
            Channel.Abort();
            Channel.Dispose();
            _connection.Close();
            _connection.Dispose();

            Channel     = null;
            _connection = null;

            State = AgentState.Disconnected;
        }
Exemple #5
0
        private void Abort(Exception exception = null)
        {
            if (exception != null)
            {
                RaiseException(exception);
            }

            aborted = true;

            upstream?.Abort();
            downstream?.Abort();

            DisposeUtils.DisposeSafely(ref source);
            DisposeUtils.DisposeSafely(ref target);
        }
        private void ReleaseChannel()
        {
            bool success = false;

            try
            {
                if (Channel.State != CommunicationState.Faulted)
                {
                    Channel.Close();
                    success = true;
                }
            }
            finally
            {
                if (!success)
                {
                    Channel.Abort();
                }
            }
        }