| 979 | } |
| 980 | |
| 981 | Future<> NetworkManagerImpl::threadTryAuth() { |
| 982 | if (auto stoken = this->getUToken()) { |
| 983 | this->connInfo()->startedAuth(); |
| 984 | this->sendCentralAuth(AuthKind::Utoken, *stoken); |
| 985 | co_return; |
| 986 | } |
| 987 | |
| 988 | // try argon / plain auth |
| 989 | auto info = this->connInfo(); |
| 990 | |
| 991 | if (!info->m_knownArgonUrl.empty()) { |
| 992 | (void) argon::setServerUrl(info->m_knownArgonUrl); |
| 993 | |
| 994 | // wait to acquire an argon token |
| 995 | info.unlock(); |
| 996 | log::debug("acquiring argon token with url {}", info->m_knownArgonUrl); |
| 997 | auto res = co_await startArgonAuth(); |
| 998 | |
| 999 | if (!res) { |
| 1000 | this->abortConnection(fmt::format("failed to complete Argon auth: {}", res.unwrapErr())); |
| 1001 | co_return; |
| 1002 | } |
| 1003 | |
| 1004 | info.relock(); |
| 1005 | info->startedAuth(); |
| 1006 | info.unlock(); |
| 1007 | |
| 1008 | this->sendCentralAuth(AuthKind::Argon, *res); |
| 1009 | } else { |
| 1010 | info->startedAuth(); |
| 1011 | info.unlock(); |
| 1012 | |
| 1013 | this->sendCentralAuth(AuthKind::Plain); |
| 1014 | } |
| 1015 | } |
| 1016 | |
| 1017 | #ifdef GEODE_IS_WINDOWS |
| 1018 | static bool isWine() { |
no test coverage detected