Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ HttpConnectionPoolManager()

System.Net.Http.HttpConnectionPoolManager.HttpConnectionPoolManager ( HttpConnectionSettings settings)
inline

Definition at line 110 of file HttpConnectionPoolManager.cs.

111 {
112 _settings = settings;
114 if (settings._maxConnectionsPerServer != int.MaxValue || (!(settings._pooledConnectionIdleTimeout == TimeSpan.Zero) && !(settings._pooledConnectionLifetime == TimeSpan.Zero)))
115 {
116 if (settings._pooledConnectionIdleTimeout == Timeout.InfiniteTimeSpan)
117 {
118 _cleanPoolTimeout = TimeSpan.FromSeconds(30.0);
119 }
120 else
121 {
122 TimeSpan timeSpan = settings._pooledConnectionIdleTimeout / 4.0;
123 _cleanPoolTimeout = ((timeSpan.TotalSeconds >= 1.0) ? timeSpan : TimeSpan.FromSeconds(1.0));
124 }
125 bool flag = false;
126 try
127 {
129 {
131 flag = true;
132 }
134 _cleaningTimer = new Timer(delegate(object s)
135 {
137 if (weakReference2.TryGetTarget(out var target2))
138 {
139 target2.RemoveStalePools();
140 }
141 }, state2, -1, -1);
143 {
144 long num = (long)Math.Max(1000.0, Math.Min(_settings._keepAlivePingDelay.TotalMilliseconds, _settings._keepAlivePingTimeout.TotalMilliseconds) / 4.0);
145 _heartBeatTimer = new Timer(delegate(object state)
146 {
148 if (weakReference.TryGetTarget(out var target))
149 {
150 target.HeartBeat();
151 }
152 }, state2, num, num);
153 }
154 }
155 finally
156 {
157 if (flag)
158 {
160 }
161 }
162 }
163 if (settings._useProxy)
164 {
165 _proxy = settings._proxy ?? HttpClient.DefaultProxy;
166 if (_proxy != null)
167 {
168 _proxyCredentials = _proxy.Credentials ?? settings._defaultProxyCredentials;
169 }
170 }
171 }
readonly ConcurrentDictionary< HttpConnectionKey, HttpConnectionPool > _pools
static AsyncFlowControl SuppressFlow()
static readonly TimeSpan InfiniteTimeSpan
Definition Timeout.cs:5
double TotalMilliseconds
Definition TimeSpan.cs:46

References System.Net.Http.HttpConnectionPoolManager._cleaningTimer, System.Net.Http.HttpConnectionPoolManager._cleanPoolTimeout, System.Net.Http.HttpConnectionSettings._defaultProxyCredentials, System.Net.Http.HttpConnectionPoolManager._heartBeatTimer, System.Net.Http.HttpConnectionSettings._keepAlivePingDelay, System.Net.Http.HttpConnectionSettings._keepAlivePingTimeout, System.Net.Http.HttpConnectionSettings._maxConnectionsPerServer, System.Net.Http.HttpConnectionSettings._pooledConnectionIdleTimeout, System.Net.Http.HttpConnectionSettings._pooledConnectionLifetime, System.Net.Http.HttpConnectionPoolManager._pools, System.Net.Http.HttpConnectionPoolManager._proxy, System.Net.Http.HttpConnectionPoolManager._proxyCredentials, System.Net.Http.HttpConnectionPoolManager._settings, System.Net.Http.HttpConnectionSettings._useProxy, System.Net.Http.HttpClient.DefaultProxy, System.TimeSpan.FromSeconds(), System.Threading.Timeout.InfiniteTimeSpan, System.Threading.ExecutionContext.IsFlowSuppressed(), System.Math.Max(), System.Math.Min(), System.Threading.ExecutionContext.RestoreFlow(), System.s, System.state, System.Threading.ExecutionContext.SuppressFlow(), System.TimeSpan.TotalMilliseconds, and System.TimeSpan.Zero.