コード例 #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing && (_connection != null))
            {
#nullable disable
                _isPubSubMode = false;
                _pubsubSender?.TryComplete();
                _pubsubSender = null;
                _connection.Dispose();
                _connection = null;
#nullable enable
            }
コード例 #2
0
        internal HostConnection RemoveConnection(ConnectionBase conn, HTTPConnectionStates setState)
        {
            conn.State = setState;
            conn.Dispose();

            bool found = this.Connections.Remove(conn);

            if (!found)
                HTTPManager.Logger.Warning(typeof(HostConnection).Name, string.Format("RemoveConnection - Couldn't find connection! key: {0}", conn.ServerAddress), this.Context, conn.Context);

            return this;
        }
コード例 #3
0
        internal HostConnection RemoveConnection(ConnectionBase conn, HTTPConnectionStates setState)
        {
            conn.State = setState;
            conn.Dispose();

            bool found = this.Connections.Remove(conn);

            if (!found)
            {
                HTTPManager.Logger.Warning(typeof(HostConnection).Name, "RemoveConnection - Couldn't find connection! key: " + conn.ServerAddress);
            }

            return(this);
        }
コード例 #4
0
        internal HostConnection RemoveConnection(ConnectionBase conn, HTTPConnectionStates setState)
        {
            conn.State = setState;
            conn.Dispose();

            bool found = this.Connections.Remove(conn);

            if (!found)
            {
                HTTPManager.Logger.Warning(typeof(HostConnection).Name, string.Format("'{0}': RemoveConnection - Couldn't find connection! key: {1}", this.VariantId, conn.ServerAddress));
            }

            return(this);
        }
コード例 #5
0
        public virtual void DisposeTest()
        {
            ConnectionBase conn = CreateConnection("test");

            try
            {
                GetConnectionAccessor(conn).Socket = new ClientSocketMock();
                conn.Open();
                Assert.IsTrue(conn.IsConnected);
                conn.Dispose();
                Assert.IsFalse(conn.IsConnected);
            }
            finally
            {
                conn.Close();
            }
        }
コード例 #6
0
ファイル: ConnectionManager.cs プロジェクト: tonycody/Library
        protected override void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    if (_connection != null)
                    {
                        try
                        {
                            _connection.Dispose();
                        }
                        catch (Exception)
                        {
                        }

                        _connection = null;
                    }
                }

                _disposed = true;
            }
        }