From 38528b797b5fa0547de834c7b2cff02b661423e8 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 15 Dec 2022 19:50:29 +0100 Subject: [PATCH] downloader: Initialize winsock even if nativenet is compiled out Fixes HTTPClient when static linking if nativenet is not used and therefore init_network() is compiled out --- panda/src/downloader/config_downloader.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/panda/src/downloader/config_downloader.cxx b/panda/src/downloader/config_downloader.cxx index cd8f1de723..6543630ed3 100644 --- a/panda/src/downloader/config_downloader.cxx +++ b/panda/src/downloader/config_downloader.cxx @@ -18,6 +18,9 @@ #include "virtualFileMountHTTP.h" #include "pandaSystem.h" +#if defined(_WIN32) && defined(HAVE_OPENSSL) +#include +#endif #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_DOWNLOADER) #error Buildsystem error: BUILDING_PANDA_DOWNLOADER not defined @@ -170,5 +173,11 @@ init_libdownloader() { PandaSystem *ps = PandaSystem::get_global_ptr(); ps->add_system("OpenSSL"); + +#ifdef _WIN32 + // We need to call this before we can open sockets on Windows. + static struct WSAData mydata; + WSAStartup(0x0101, &mydata); +#endif // _WIN32 #endif // HAVE_OPENSSL }