http: Always use/require progress in requests.

This fixes several cases where we weren't passing cancel flags
consistently.
This commit is contained in:
Unknown W. Brackets 2021-05-01 10:19:27 -07:00
parent f762fbc53d
commit 3379f33882
9 changed files with 69 additions and 59 deletions

View file

@ -63,6 +63,7 @@ static ServerStatus RetrieveStatus() {
static bool RegisterServer(int port) {
bool success = false;
http::Client http;
http::RequestProgress progress;
Buffer theVoid;
http.SetUserAgent(StringFromFormat("PPSSPP/%s", PPSSPP_GIT_VERSION));
@ -73,7 +74,7 @@ static bool RegisterServer(int port) {
std::string ip = fd_util::GetLocalIP(http.sock());
snprintf(resource4, sizeof(resource4) - 1, "/match/update?local=%s&port=%d", ip.c_str(), port);
if (http.GET(resource4, &theVoid) > 0)
if (http.GET(resource4, &theVoid, &progress) > 0)
success = true;
theVoid.Skip(theVoid.size());
http.Disconnect();
@ -86,7 +87,7 @@ static bool RegisterServer(int port) {
// We register both IPv4 and IPv6 in case the other client is using a different one.
if (resource4[0] != 0 && http.Connect(timeout)) {
if (http.GET(resource4, &theVoid) > 0)
if (http.GET(resource4, &theVoid, &progress) > 0)
success = true;
theVoid.Skip(theVoid.size());
http.Disconnect();
@ -98,7 +99,7 @@ static bool RegisterServer(int port) {
std::string ip = fd_util::GetLocalIP(http.sock());
snprintf(resource6, sizeof(resource6) - 1, "/match/update?local=%s&port=%d", ip.c_str(), port);
if (http.GET(resource6, &theVoid) > 0)
if (http.GET(resource6, &theVoid, &progress) > 0)
success = true;
theVoid.Skip(theVoid.size());
http.Disconnect();