예제 #1
0
        private bool WaitUsingEvent(long smtpSessionId, TimeSpan timeout)
        {
            PooledEvent pooledEvent = null;

            if (!this.sessionEvents.TryGetValue(smtpSessionId, out pooledEvent))
            {
                throw new InvalidOperationException("The session event was not able to be retrieved when attempting to wait for a connection.");
            }
            return(pooledEvent.WaitHandle.WaitOne(timeout));
        }
예제 #2
0
        private void SetSessionEvent(long smtpSessionId)
        {
            PooledEvent pooledEvent = null;

            if (!this.sessionEvents.TryGetValue(smtpSessionId, out pooledEvent))
            {
                throw new InvalidOperationException("The session event was not able to be retrieved when attempting to wake a thread waiting for a connection.");
            }
            pooledEvent.WaitHandle.Set();
        }
예제 #3
0
        private bool RemoveConnectionTrackingItems(long smtpSessionId)
        {
            MailboxDatabaseConnectionManager.ConnectionInfo connectionInfo = null;
            bool        result = this.connections.TryRemove(smtpSessionId, out connectionInfo);
            PooledEvent value  = null;
            bool        flag   = this.sessionEvents.TryRemove(smtpSessionId, out value);

            if (flag)
            {
                this.eventPool.Release(value);
            }
            return(result);
        }