refactor: Return std::optional from GetProxy

This commit is contained in:
MarcoFalke
2026-02-05 16:35:14 +01:00
parent faeac1a931
commit fa270fdacf
8 changed files with 45 additions and 44 deletions

View File

@@ -706,13 +706,14 @@ bool SetProxy(enum Network net, const Proxy &addrProxy) {
return true;
}
bool GetProxy(enum Network net, Proxy &proxyInfoOut) {
std::optional<Proxy> GetProxy(enum Network net)
{
assert(net >= 0 && net < NET_MAX);
LOCK(g_proxyinfo_mutex);
if (!proxyInfo[net].IsValid())
return false;
proxyInfoOut = proxyInfo[net];
return true;
if (!proxyInfo[net].IsValid()) {
return std::nullopt;
}
return proxyInfo[net];
}
bool SetNameProxy(const Proxy &addrProxy) {