Exemplo n.º 1
0
        /// <summary>
        ///     Remove the socket contained in the given state object
        ///     from the connected array list and hash table, then close the
        ///     socket
        /// </summary>
        protected virtual void CloseSocket(SocketState state)
        {
            lock (ConnectedSockets) {
                SocketState actual_state;
                if (ConnectedSockets.TryGetValue(state.guid, out actual_state) == false) {
                    return;
                }

                Debug.Assert(actual_state == state);
                ConnectedSockets.Remove(state.guid);
            }

            state.CloseSocket();
        }