mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-12 17:19:28 +01:00
naett: Let naettInit be called more than once
It asserted that it was the first call, so net::Init - which is documented as safe to call repeatedly, and is - needed a bool of its own purely to guard this one line. That's bookkeeping the library may as well do itself, and the WSA half of the same function already says as much: it doesn't track anything because WSAStartup counts its own references. So a repeat call does nothing, and net::Init loses g_naettInitialized. Asking HTTPSAvailable() twice costs nothing - on Linux it's a cached dlopen result and everywhere else it's a constant.
This commit is contained in:
1 parent
bc095c5e31
commit
618bdc2d72
4 files changed
+21
-11
No files matched your search
+8
-10
@@ -31,7 +31,6 @@ extern JavaVM *gJvm;
|
||||
|
||||
namespace net {
|
||||
|
||||
static bool g_naettInitialized;
|
||||
static bool g_wsaInitialized;
|
||||
|
||||
void Init() {
|
||||
@@ -44,19 +43,18 @@ void Init() {
|
||||
g_wsaInitialized = true;
|
||||
}
|
||||
#endif
|
||||
if (!g_naettInitialized) {
|
||||
// naett ignores repeat calls the same way WSAStartup does, so there's nothing to track here
|
||||
// either. HTTPSAvailable is cheap to ask twice - on Linux it's a cached dlopen result.
|
||||
#ifndef HTTPS_NOT_AVAILABLE
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
_assert_(gJvm != nullptr);
|
||||
naettInit(gJvm);
|
||||
_assert_(gJvm != nullptr);
|
||||
naettInit(gJvm);
|
||||
#else
|
||||
if (HTTPSAvailable()) {
|
||||
naettInit(NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
g_naettInitialized = true;
|
||||
if (HTTPSAvailable()) {
|
||||
naettInit(NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool HTTPSAvailable() {
|
||||
|
||||
Reference in new issue
Block a user