mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-15 06:42:25 +02:00
Happy Eyeballs for HttpClient use.
All HttpClient usages in the engine now use Happy Eyeballs, same implementation as the launcher. Makes a IHttpClientHolder type so content can profit from this technology too. Didn't make use of this in all HttpClient usages in the engine itself, due to varying circumstances making it annoying to refactor.
This commit is contained in:
@@ -6,6 +6,7 @@ using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -71,12 +72,12 @@ internal sealed class HubManager
|
||||
_interval = TimeSpan.FromSeconds(interval);
|
||||
_httpClient?.Dispose();
|
||||
|
||||
_httpClient = new HttpClient(new SocketsHttpHandler
|
||||
{
|
||||
// Keep-alive connections stay open for longer than the advertise interval.
|
||||
// This way the same HTTPS connection can be re-used.
|
||||
PooledConnectionIdleTimeout = _interval + TimeSpan.FromSeconds(10),
|
||||
});
|
||||
var socketsHandler = HappyEyeballsHttp.CreateHttpHandler();
|
||||
// Keep-alive connections stay open for longer than the advertise interval.
|
||||
// This way the same HTTPS connection can be re-used.
|
||||
socketsHandler.PooledConnectionIdleTimeout = _interval + TimeSpan.FromSeconds(10);
|
||||
|
||||
_httpClient = new HttpClient(socketsHandler);
|
||||
|
||||
HttpClientUserAgent.AddUserAgent(_httpClient);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user