void ReuseConnectionCallback(object state) { ReuseConnectionState connectionState = (ReuseConnectionState)state; bool closeReader = false; lock (ThisLock) { if (pooledConnectionCount >= maxPooledConnections) { closeReader = true; } else { pooledConnectionCount++; } } if (closeReader) { connectionState.ModeReader.CloseFromPool(connectionState.CloseTimeout); } else { if (pooledConnectionDequeuedCallback == null) { pooledConnectionDequeuedCallback = new Action(PooledConnectionDequeuedCallback); } connectionState.ModeReader.StartReading(idleTimeout, pooledConnectionDequeuedCallback); } }
private void ReuseConnectionCallback(object state) { ReuseConnectionState state2 = (ReuseConnectionState)state; bool flag = false; lock (this.ThisLock) { if (this.pooledConnectionCount >= this.maxPooledConnections) { flag = true; } else { this.pooledConnectionCount++; } } if (flag) { if (DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, 0x40006, System.ServiceModel.SR.GetString("TraceCodeServerMaxPooledConnectionsQuotaReached", new object[] { this.maxPooledConnections }), new StringTraceRecord("MaxOutboundConnectionsPerEndpoint", this.maxPooledConnections.ToString(CultureInfo.InvariantCulture)), this, null); } state2.ModeReader.CloseFromPool(state2.CloseTimeout); } else { if (this.pooledConnectionDequeuedCallback == null) { this.pooledConnectionDequeuedCallback = new Action(this.PooledConnectionDequeuedCallback); } state2.ModeReader.StartReading(this.idleTimeout, this.pooledConnectionDequeuedCallback); } }
void ReuseConnectionCallback(object state) { ReuseConnectionState connectionState = (ReuseConnectionState)state; bool closeReader = false; lock (ThisLock) { if (this.pooledConnectionCount >= this.maxPooledConnections) { closeReader = true; } else { this.pooledConnectionCount++; } } if (closeReader) { if (DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, TraceCode.ServerMaxPooledConnectionsQuotaReached, SR.GetString(SR.TraceCodeServerMaxPooledConnectionsQuotaReached, maxPooledConnections), new StringTraceRecord("MaxOutboundConnectionsPerEndpoint", maxPooledConnections.ToString(CultureInfo.InvariantCulture)), this, null); } if (TD.ServerMaxPooledConnectionsQuotaReachedIsEnabled()) { TD.ServerMaxPooledConnectionsQuotaReached(); } connectionState.ModeReader.CloseFromPool(connectionState.CloseTimeout); } else { if (this.pooledConnectionDequeuedCallback == null) { this.pooledConnectionDequeuedCallback = new Action(PooledConnectionDequeuedCallback); } connectionState.ModeReader.StartReading(this.idleTimeout, this.pooledConnectionDequeuedCallback); } }