mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-15 15:30:29 +02:00
Remove sleeps and timed polling from networking
Socket waits now block in select() on the socket plus a wake or cancel socket (Common/Net/Cancel), so a stop or cancel ends them at once. - HTTP: cancel flags become net::CancelToken; Connect waits once on all addresses, receives wait instead of spinning, no DNS retry sleep. - Adhoc: the friend finder and adhoc server block on their sockets with a wake socket and a deadline; matching runs on a CoreTiming tick instead of two threads (savestate section bumped). - sceNetInet select/poll check without blocking and park the HLE thread, re-checked from a CoreTiming event until ready or the emulated timeout. - Vendor the aemu_postoffice client (was a submodule) with no sleeps: waits on the socket, close via shutdown and an eventcount, cancelable connects, and lock-free session slot claims. - PortManager waits without a timeout; PSP_InitWait replaces the headless boot poll. - TimeUtil: sleep_us/sleep_ms only outside the core; sleep_precise, sleep_random, yield and the Windows timer period are gone. - Unit test for the socket waits.
This commit is contained in:
1 parent
9f13f0f051
commit
5f0f72bfda
58 files changed
+3822
-763
No files matched your search
@@ -10,8 +10,8 @@
|
||||
|
||||
namespace http {
|
||||
|
||||
Request::Request(RequestMethod method, std::string_view url, std::string_view name, const Path &outFile, bool *cancelled, RequestFlags flags)
|
||||
: method_(method), url_(url), name_(name), outfile_(outFile), progress_(cancelled), flags_(flags) {
|
||||
Request::Request(RequestMethod method, std::string_view url, std::string_view name, const Path &outFile, RequestFlags flags)
|
||||
: method_(method), url_(url), name_(name), outfile_(outFile), progress_(&cancel_), flags_(flags) {
|
||||
INFO_LOG(Log::HTTP, "HTTP %s request: %.*s (%.*s)", RequestMethodToString(method), (int)url.size(), url.data(), (int)name.size(), name.data());
|
||||
|
||||
progress_.callback = [this](int64_t bytes, int64_t contentLength, bool done) {
|
||||
@@ -98,7 +98,7 @@ std::shared_ptr<Request> RequestManager::StartDownload(std::string_view url, con
|
||||
if (File::ReadBinaryFileToString(cacheFile, &contents)) {
|
||||
INFO_LOG(Log::HTTP, "Returning cached file for %.*s: %s", STR_VIEW(url), cacheFile.c_str());
|
||||
// All is well, but we've indented a bit much here.
|
||||
std::shared_ptr<Request> dl(new CachedRequest(RequestMethod::GET, url, KeepAfterLast(url, '/'), nullptr, flags, contents));
|
||||
std::shared_ptr<Request> dl(new CachedRequest(RequestMethod::GET, url, KeepAfterLast(url, '/'), flags, contents));
|
||||
newDownloads_.push_back(dl);
|
||||
dl->SetCallback(completionCallback);
|
||||
return dl;
|
||||
|
||||
Reference in new issue
Block a user