From a3a874f4d6d9e63b48272a758c7df9ff7781cfdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Mon, 24 Oct 2022 22:11:13 +0200 Subject: [PATCH] Get png avatars from the static server Also restore concurrent connection / stream counts, and fix a bug that would cause AvatarButtons to try to fetch avatars before they knew what name they belonged to. I apparently broke this in the first PNG commit. --- src/client/http/RequestManager.cpp | 4 ++-- src/gui/interface/AvatarButton.cpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/client/http/RequestManager.cpp b/src/client/http/RequestManager.cpp index 99b132dc2..4bccdf63f 100644 --- a/src/client/http/RequestManager.cpp +++ b/src/client/http/RequestManager.cpp @@ -5,8 +5,8 @@ #include const int curl_multi_wait_timeout_ms = 100; -const long curl_max_host_connections = 1; -const long curl_max_concurrent_streams = 1; +const long curl_max_host_connections = 2; +const long curl_max_concurrent_streams = 50; namespace http { diff --git a/src/gui/interface/AvatarButton.cpp b/src/gui/interface/AvatarButton.cpp index 4ea60f37c..6409457f3 100644 --- a/src/gui/interface/AvatarButton.cpp +++ b/src/gui/interface/AvatarButton.cpp @@ -26,12 +26,10 @@ void AvatarButton::OnResponse(std::unique_ptr Avatar) void AvatarButton::Tick(float dt) { - if(!avatar && !tried) + if (!avatar && !tried && name.size() > 0) { tried = true; - // TODO: Currently a very expensive-to-call endpoint; skips the cache server. If we call it too quickly, we get banned as - // an anti-DoS measure. This is why concurrent connections / connection multiplexing have been temporarily disabled. - RequestSetup(SCHEME SERVER "/Mini/GetAvatarPng.php?Username=" + name, Size.X, Size.Y); + RequestSetup(SCHEME STATICSERVER "/avatars/" + name + ".png", Size.X, Size.Y); RequestStart(); }