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.
This commit is contained in:
Tamás Bálint Misius 2022-10-24 22:11:13 +02:00
parent 1f7b01bd9e
commit a3a874f4d6
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 4 additions and 6 deletions

View File

@ -5,8 +5,8 @@
#include <iostream>
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
{

View File

@ -26,12 +26,10 @@ void AvatarButton::OnResponse(std::unique_ptr<VideoBuffer> 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();
}