Remove accidental usage of the async pipeline (#305)
Removing the parameter default value will prevent this from happening in the future
This commit is contained in:
parent
19d17440ec
commit
e754e9d56a
@ -101,23 +101,17 @@ namespace Components
|
|||||||
|
|
||||||
void Dedicated::TimeWrapStub(Game::errorParm_t code, const char* message)
|
void Dedicated::TimeWrapStub(Game::errorParm_t code, const char* message)
|
||||||
{
|
{
|
||||||
static bool partyEnable;
|
Scheduler::Once([]
|
||||||
static std::string mapname;
|
|
||||||
|
|
||||||
partyEnable = Dvar::Var("party_enable").get<bool>();
|
|
||||||
mapname = Dvar::Var("mapname").get<std::string>();
|
|
||||||
|
|
||||||
Scheduler::Once([]()
|
|
||||||
{
|
{
|
||||||
Dvar::Var("party_enable").set(partyEnable);
|
const auto partyEnable = Dvar::Var("party_enable").get<bool>();
|
||||||
|
auto mapname = Dvar::Var("mapname").get<std::string>();
|
||||||
|
|
||||||
if (!partyEnable) // Time wrapping should not occur in party servers, but yeah...
|
if (!partyEnable) // Time wrapping should not occur in party servers, but yeah...
|
||||||
{
|
{
|
||||||
if (mapname.empty()) mapname = "mp_rust";
|
if (mapname.empty()) mapname = "mp_rust";
|
||||||
Command::Execute(Utils::String::VA("map %s", mapname.data()), false);
|
Command::Execute(Utils::String::VA("map %s", mapname.data()), false);
|
||||||
mapname.clear();
|
|
||||||
}
|
}
|
||||||
});
|
}, Scheduler::Pipeline::SERVER);
|
||||||
|
|
||||||
Game::Com_Error(code, message);
|
Game::Com_Error(code, message);
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,12 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if (Download::CLDownload.running) return;
|
if (Download::CLDownload.running) return;
|
||||||
|
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
Dvar::Var("ui_dl_timeLeft").set(Utils::String::FormatTimeSpan(0));
|
Dvar::Var("ui_dl_timeLeft").set(Utils::String::FormatTimeSpan(0));
|
||||||
Dvar::Var("ui_dl_progress").set("(0/0) %");
|
Dvar::Var("ui_dl_progress").set("(0/0) %");
|
||||||
Dvar::Var("ui_dl_transRate").set("0.0 MB/s");
|
Dvar::Var("ui_dl_transRate").set("0.0 MB/s");
|
||||||
});
|
}, Scheduler::Pipeline::MAIN);
|
||||||
|
|
||||||
Command::Execute("openmenu mod_download_popmenu", false);
|
Command::Execute("openmenu mod_download_popmenu", false);
|
||||||
|
|
||||||
@ -155,22 +155,23 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string host = "http://" + download->target.getString();
|
auto host = "http://" + download->target.getString();
|
||||||
std::string fastHost = Dvar::Var("sv_wwwBaseUrl").get<std::string>();
|
auto fastHost = Dvar::Var("sv_wwwBaseUrl").get<std::string>();
|
||||||
if (Utils::String::StartsWith(fastHost, "https://"))
|
if (Utils::String::StartsWith(fastHost, "https://"))
|
||||||
{
|
{
|
||||||
download->thread.detach();
|
download->thread.detach();
|
||||||
download->clear();
|
download->clear();
|
||||||
|
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
Command::Execute("closemenu mod_download_popmenu");
|
Command::Execute("closemenu mod_download_popmenu");
|
||||||
Party::ConnectError("HTTPS not supported for downloading!");
|
Party::ConnectError("HTTPS not supported for downloading!");
|
||||||
});
|
}, Scheduler::Pipeline::CLIENT);
|
||||||
|
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
else if (!Utils::String::StartsWith(fastHost, "http://"))
|
|
||||||
|
if (!Utils::String::StartsWith(fastHost, "http://"))
|
||||||
{
|
{
|
||||||
fastHost = "http://" + fastHost;
|
fastHost = "http://" + fastHost;
|
||||||
}
|
}
|
||||||
@ -277,11 +278,11 @@ namespace Components
|
|||||||
download->thread.detach();
|
download->thread.detach();
|
||||||
download->clear();
|
download->clear();
|
||||||
|
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
Command::Execute("closemenu mod_download_popmenu");
|
Command::Execute("closemenu mod_download_popmenu");
|
||||||
Party::ConnectError("Failed to download the modlist!");
|
Party::ConnectError("Failed to download the modlist!");
|
||||||
});
|
}, Scheduler::Pipeline::CLIENT);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -295,11 +296,11 @@ namespace Components
|
|||||||
download->thread.detach();
|
download->thread.detach();
|
||||||
download->clear();
|
download->clear();
|
||||||
|
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
Command::Execute("closemenu mod_download_popmenu");
|
Command::Execute("closemenu mod_download_popmenu");
|
||||||
Party::ConnectError("Failed to parse the modlist!");
|
Party::ConnectError("Failed to parse the modlist!");
|
||||||
});
|
}, Scheduler::Pipeline::CLIENT);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -321,14 +322,14 @@ namespace Components
|
|||||||
download->thread.detach();
|
download->thread.detach();
|
||||||
download->clear();
|
download->clear();
|
||||||
|
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
Dvar::Var("partyend_reason").set(mod);
|
Dvar::Var("partyend_reason").set(mod);
|
||||||
mod.clear();
|
mod.clear();
|
||||||
|
|
||||||
Command::Execute("closemenu mod_download_popmenu");
|
Command::Execute("closemenu mod_download_popmenu");
|
||||||
Command::Execute("openmenu menu_xboxlive_partyended");
|
Command::Execute("openmenu menu_xboxlive_partyended");
|
||||||
});
|
}, Scheduler::Pipeline::CLIENT);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -341,15 +342,15 @@ namespace Components
|
|||||||
|
|
||||||
if (download->isMap)
|
if (download->isMap)
|
||||||
{
|
{
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
Command::Execute("reconnect", false);
|
Command::Execute("reconnect", false);
|
||||||
});
|
}, Scheduler::Pipeline::CLIENT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Run this on the main thread
|
// Run this on the main thread
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
auto fsGame = Dvar::Var("fs_game");
|
auto fsGame = Dvar::Var("fs_game");
|
||||||
fsGame.set(mod);
|
fsGame.set(mod);
|
||||||
@ -364,7 +365,7 @@ namespace Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
Command::Execute("reconnect", false);
|
Command::Execute("reconnect", false);
|
||||||
});
|
}, Scheduler::Pipeline::MAIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,11 +420,11 @@ namespace Components
|
|||||||
dlProgress = static_cast<unsigned int>(progress);
|
dlProgress = static_cast<unsigned int>(progress);
|
||||||
|
|
||||||
framePushed = true;
|
framePushed = true;
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
framePushed = false;
|
framePushed = false;
|
||||||
Dvar::Var("ui_dl_progress").set(Utils::String::VA("(%d/%d) %d%%", dlIndex, dlSize, dlProgress));
|
Dvar::Var("ui_dl_progress").set(Utils::String::VA("(%d/%d) %d%%", dlIndex, dlSize, dlProgress));
|
||||||
});
|
}, Scheduler::Pipeline::CLIENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int delta = Game::Sys_Milliseconds() - fDownload->download->lastTimeStamp;
|
int delta = Game::Sys_Milliseconds() - fDownload->download->lastTimeStamp;
|
||||||
@ -449,11 +450,11 @@ namespace Components
|
|||||||
dlDelta = delta;
|
dlDelta = delta;
|
||||||
dlTsBytes = fDownload->download->timeStampBytes;
|
dlTsBytes = fDownload->download->timeStampBytes;
|
||||||
|
|
||||||
Scheduler::Once([]()
|
Scheduler::Once([]
|
||||||
{
|
{
|
||||||
Dvar::Var("ui_dl_timeLeft").set(Utils::String::FormatTimeSpan(dlTimeLeft));
|
Dvar::Var("ui_dl_timeLeft").set(Utils::String::FormatTimeSpan(dlTimeLeft));
|
||||||
Dvar::Var("ui_dl_transRate").set(Utils::String::FormatBandwidth(dlTsBytes, dlDelta));
|
Dvar::Var("ui_dl_transRate").set(Utils::String::FormatBandwidth(dlTsBytes, dlDelta));
|
||||||
});
|
}, Scheduler::Pipeline::MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
fDownload->download->timeStampBytes = 0;
|
fDownload->download->timeStampBytes = 0;
|
||||||
|
@ -739,7 +739,7 @@ namespace Components
|
|||||||
Friends::UpdateState();
|
Friends::UpdateState();
|
||||||
|
|
||||||
Friends::UpdateFriends();
|
Friends::UpdateFriends();
|
||||||
});
|
}, Scheduler::Pipeline::MAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
Friends::~Friends()
|
Friends::~Friends()
|
||||||
|
@ -20,13 +20,13 @@ namespace Components
|
|||||||
|
|
||||||
void preDestroy() override;
|
void preDestroy() override;
|
||||||
|
|
||||||
static void Schedule(const std::function<bool()>& callback, Pipeline type = Pipeline::ASYNC,
|
static void Schedule(const std::function<bool()>& callback, Pipeline type,
|
||||||
std::chrono::milliseconds delay = 0ms);
|
std::chrono::milliseconds delay = 0ms);
|
||||||
static void Loop(const std::function<void()>& callback, Pipeline type = Pipeline::ASYNC,
|
static void Loop(const std::function<void()>& callback, Pipeline type,
|
||||||
std::chrono::milliseconds delay = 0ms);
|
std::chrono::milliseconds delay = 0ms);
|
||||||
static void Once(const std::function<void()>& callback, Pipeline type = Pipeline::ASYNC,
|
static void Once(const std::function<void()>& callback, Pipeline type,
|
||||||
std::chrono::milliseconds delay = 0ms);
|
std::chrono::milliseconds delay = 0ms);
|
||||||
static void OnGameInitialized(const std::function<void()>& callback, Pipeline type = Pipeline::ASYNC,
|
static void OnGameInitialized(const std::function<void()>& callback, Pipeline type,
|
||||||
std::chrono::milliseconds delay = 0ms);
|
std::chrono::milliseconds delay = 0ms);
|
||||||
static void OnGameShutdown(const std::function<void()>& callback);
|
static void OnGameShutdown(const std::function<void()>& callback);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user