Пример #1
0
        public override void close()
        {
            if (Engine.remove(this))
            {
                return;
            }
            lock (locker)
            {
                autoReconnect = false;
                switch (state)
                {
                case State.EXCHANGE:
                    StateTransportImpl _transport = transport;
                    transport = null;
                    _transport.close();
                    while (state != State.CLOSE)
                    {
                        Monitor.Wait(locker);
                    }
                    break;

                case State.CONNECTING:
                    Exception e = dispatcher.run(() => listener.onAbort(null));
                    if (e != null && Trace.isErrorEnabled())
                    {
                        Trace.error(this + " connectAbort", e);
                    }
                    break;

                case State.INIT:
                    if (future != null)
                    {
                        future.Dispose();
                    }
                    break;
                }
                dispatcher.await();
                dispatcher.run(() => listener.onManagerUninitialized(this));
            }
        }