Skip to content

Commit

Permalink
Get rid of "AutoInit", instead always keep the network initialized.
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Feb 14, 2017
1 parent 6e940df commit cbf24a9
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 14 deletions.
1 change: 0 additions & 1 deletion Core/FileLoaders/HTTPFileLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class HTTPFileLoader : public FileLoader {
s64 filesize_;
s64 filepos_;
Url url_;
net::AutoInit netInit_;
http::Client client_;
std::string filename_;
bool connected_;
Expand Down
1 change: 0 additions & 1 deletion Core/Reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion UI/RemoteISOScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion Windows/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -528,6 +529,7 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
W32Util::ExitAndRestart();
}

net::Shutdown();
CoUninitialize();

return 0;
Expand Down
1 change: 0 additions & 1 deletion ext/native/net/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down
9 changes: 0 additions & 9 deletions ext/native/net/resolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cbf24a9

Please sign in to comment.