[Download] Fix crash if TCP port is blocked

This commit is contained in:
momo5502 2017-02-02 21:07:40 +01:00
parent 8506a1bc51
commit 9cb7e0dffa

View File

@ -598,12 +598,19 @@ namespace Components
{
mg_connection* nc = mg_bind(&Download::Mgr, Utils::String::VA("%hu", (Dvar::Var("net_port").get<int>() & 0xFFFF)), Download::EventHandler);
// Handle special requests
mg_register_http_endpoint(nc, "/info", Download::InfoHandler);
mg_register_http_endpoint(nc, "/list", Download::ListHandler);
mg_register_http_endpoint(nc, "/file", Download::FileHandler);
if (nc)
{
// Handle special requests
mg_register_http_endpoint(nc, "/info", Download::InfoHandler);
mg_register_http_endpoint(nc, "/list", Download::ListHandler);
mg_register_http_endpoint(nc, "/file", Download::FileHandler);
mg_set_protocol_http_websocket(nc);
mg_set_protocol_http_websocket(nc);
}
else
{
Logger::Print("Failed to bind TCP socket, moddownload won't work!\n");
}
});
QuickPatch::OnFrame([]