Get rid of "AutoInit", instead always keep the network initialized.

See #9305
This commit is contained in:
Henrik Rydgard committed 2017-02-14 13:12:02 +01:00
1 parent 6e940dfeda
commit cbf24a9d78
6 files changed
+3 -14

No files matched your search

-1
View File
@@ -65,7 +65,6 @@ private:
s64 filesize_;
s64 filepos_;
Url url_;
net::AutoInit netInit_;
http::Client client_;
std::string filename_;
bool connected_;
-1
View File
@@ -217,7 +217,6 @@ namespace Reporting
bool SendReportRequest(const char *uri, const std::string &data, const std::string &mimeType, Buffer *output = NULL)
{
bool result = false;
net::AutoInit netInit;
http::Client http;
Buffer theVoid;
-1
View File
@@ -81,7 +81,6 @@ static void RegisterServer(int port) {
static void ExecuteServer() {
setCurrentThreadName("HTTPServer");
net::AutoInit netInit;
auto http = new http::Server(new threading::SameThreadExecutor());
std::map<std::string, std::string> paths;
+3 -1
View File
@@ -32,6 +32,7 @@
#include "profiler/profiler.h"
#include "thread/threadutil.h"
#include "util/text/utf8.h"
#include "net/resolve.h"
#include "Core/Config.h"
#include "Core/SaveState.h"
@@ -294,7 +295,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
setCurrentThreadName("Main");
CoInitializeEx(NULL, COINIT_MULTITHREADED);
net::Init();
#ifdef _DEBUG
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
@@ -528,6 +529,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
W32Util::ExitAndRestart();
}
net::Shutdown();
CoUninitialize();
return 0;
-1
View File
@@ -401,7 +401,6 @@ void Download::Do(std::shared_ptr<Download> self) {
SetFailed(-1);
return;
}
net::AutoInit netInit;
http::Client client;
if (!client.Resolve(fileUrl.Host().c_str(), fileUrl.Port())) {
-9
View File
@@ -10,15 +10,6 @@ namespace net {
void Init();
void Shutdown();
struct AutoInit {
AutoInit() {
Init();
}
~AutoInit() {
Shutdown();
}
};
// use free() to free the returned string.
char *DNSResolveTry(const char *host, const char **err);
char *DNSResolve(const char *host);