http: bound spawn_http concurrency (http_max_concurrent, default 32) like spawn_crypto — it spawned one unbounded OS thread per call, so a pre-auth VERIFY/REGISTER flood could exhaust threads and hammer the accounts backend; at capacity the command now fails with TEMPORARILY_UNAVAILABLE instead

This commit is contained in:
Jean Chevronnet 2026-08-19 00:39:01 +00:00
parent 801614605f
commit bbe4ee4567
2 changed files with 40 additions and 5 deletions

View file

@ -203,13 +203,21 @@ impl Command for Register {
urlencode(&ip),
port
);
s.spawn_http(
if !s.spawn_http(
uid,
format!("acctreg:register:{account}"),
url,
body,
apikey_headers(s),
);
) {
s.fail(
uid,
"REGISTER",
"TEMPORARILY_UNAVAILABLE",
"The server is busy; please try again in a moment.",
);
return CmdResult::Fail;
}
CmdResult::Ok
}
}
@ -252,13 +260,21 @@ impl Command for Verify {
urlencode(&account),
urlencode(&params[1])
);
s.spawn_http(
if !s.spawn_http(
uid,
format!("acctreg:verify:{account}"),
url,
body,
apikey_headers(s),
);
) {
s.fail(
uid,
"VERIFY",
"TEMPORARILY_UNAVAILABLE",
"The server is busy; please try again in a moment.",
);
return CmdResult::Fail;
}
CmdResult::Ok
}
}