Exemplo n.º 1
0
        protected void Close(Connection.Base connection)
        {
            if (connection != null)
            {
                if (connection is Connection.Tcp)
                {
                    lock (initializedConnections)
                    {
                        initializedConnections.Remove(connection as Connection.Tcp);
                    }
                }

                if (connection.Channel != ushort.MaxValue)
                {
                    lock (openedChannels)
                    {
                        Connection.Base[] connections;

                        if (openedChannels.TryGetValue(connection.Remote, out connections))
                        {
                            connections[connection.Channel] = null;
                        }

                        openedChannels.Remove(connection.Remote);
                    }
                }

                connection.Close();
            }
        }