コード例 #1
0
        // Stops tracking a socket
        public void Remove(IAsyncAbortableWebSocket webSocket) {
            int activeSocketCount;

            // keep the lock for as short a period as possible
            lock (_activeSockets) {
                _activeSockets.Remove(webSocket);
                activeSocketCount = _activeSockets.Count;
            }

            // perform any additional operations outside the lock
            _perfCounters.SetCounter(AppPerfCounter.REQUESTS_EXECUTING_WEBSOCKETS, activeSocketCount);
        }
コード例 #2
0
        // Stops tracking a socket
        public void Remove(IAsyncAbortableWebSocket webSocket)
        {
            int activeSocketCount;

            // keep the lock for as short a period as possible
            lock (_activeSockets) {
                _activeSockets.Remove(webSocket);
                activeSocketCount = _activeSockets.Count;
            }

            // perform any additional operations outside the lock
            _perfCounters.SetCounter(AppPerfCounter.REQUESTS_EXECUTING_WEBSOCKETS, activeSocketCount);
        }
コード例 #3
0
        // Begins tracking a socket, calling Abort() if there was an earlier call to AbortAll()
        public void Add(IAsyncAbortableWebSocket webSocket) {
            int activeSocketCount;
            bool shouldAbort;

            // keep the lock for as short a period as possible
            lock (_activeSockets) {
                _activeSockets.Add(webSocket);
                activeSocketCount = _activeSockets.Count;
                shouldAbort = _aborted;
            }

            // perform any additional operations outside the lock
            _perfCounters.SetCounter(AppPerfCounter.REQUESTS_EXECUTING_WEBSOCKETS, activeSocketCount);
            if (shouldAbort) {
                webSocket.AbortAsync(); // don't care about the result of the abort at the present time
            }
        }
コード例 #4
0
        // Begins tracking a socket, calling Abort() if there was an earlier call to AbortAll()
        public void Add(IAsyncAbortableWebSocket webSocket)
        {
            int  activeSocketCount;
            bool shouldAbort;

            // keep the lock for as short a period as possible
            lock (_activeSockets) {
                _activeSockets.Add(webSocket);
                activeSocketCount = _activeSockets.Count;
                shouldAbort       = _aborted;
            }

            // perform any additional operations outside the lock
            _perfCounters.SetCounter(AppPerfCounter.REQUESTS_EXECUTING_WEBSOCKETS, activeSocketCount);
            if (shouldAbort)
            {
                webSocket.AbortAsync(); // don't care about the result of the abort at the present time
            }
        }