Emscripten: Cosmetics
This commit is contained in:
parent
c725894abd
commit
5c816fe1ee
@ -88,7 +88,7 @@ namespace http
|
||||
return handle->state == RequestHandle::done;
|
||||
}
|
||||
|
||||
std::pair<int, int> Request::CheckProgress() const
|
||||
std::pair<int64_t, int64_t> Request::CheckProgress() const
|
||||
{
|
||||
std::lock_guard lk(handle->stateMx);
|
||||
assert(handle->state == RequestHandle::running || handle->state == RequestHandle::done);
|
||||
|
@ -39,7 +39,7 @@ namespace http
|
||||
void Start();
|
||||
bool CheckDone() const;
|
||||
|
||||
std::pair<int, int> CheckProgress() const; // total, done
|
||||
std::pair<int64_t, int64_t> CheckProgress() const; // total, done
|
||||
const std::vector<ByteString> &ResponseHeaders() const;
|
||||
void Wait();
|
||||
|
||||
|
@ -221,8 +221,8 @@ namespace http
|
||||
HandleCURLcode(curl_easy_getinfo(handle->curlEasy, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &total)); // stores -1 if unknown
|
||||
HandleCURLcode(curl_easy_getinfo(handle->curlEasy, CURLINFO_SIZE_DOWNLOAD, &done));
|
||||
#endif
|
||||
handle->bytesTotal = int(total);
|
||||
handle->bytesDone = int(done);
|
||||
handle->bytesTotal = int64_t(total);
|
||||
handle->bytesDone = int64_t(done);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "common/String.h"
|
||||
#include "client/http/PostData.h"
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@ -38,8 +39,8 @@ namespace http
|
||||
State state = ready;
|
||||
std::mutex stateMx;
|
||||
std::condition_variable stateCv;
|
||||
std::atomic<int> bytesTotal = -1;
|
||||
std::atomic<int> bytesDone = 0;
|
||||
std::atomic<int64_t> bytesTotal = -1;
|
||||
std::atomic<int64_t> bytesDone = 0;
|
||||
int statusCode = 0;
|
||||
ByteString responseData;
|
||||
std::vector<ByteString> responseHeaders;
|
||||
|
@ -58,13 +58,13 @@ inline ByteString IntroText()
|
||||
{
|
||||
sb << " NOHTTP";
|
||||
}
|
||||
else if constexpr (ENFORCE_HTTPS)
|
||||
{
|
||||
sb << " HTTPS";
|
||||
}
|
||||
if constexpr (DEBUG)
|
||||
{
|
||||
sb << " DEBUG";
|
||||
}
|
||||
if constexpr (ENFORCE_HTTPS)
|
||||
{
|
||||
sb << " HTTPS";
|
||||
}
|
||||
return sb.Build();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ private:
|
||||
notifyProgress(-1);
|
||||
while(!request->CheckDone())
|
||||
{
|
||||
int total, done;
|
||||
int64_t total, done;
|
||||
std::tie(total, done) = request->CheckProgress();
|
||||
if (total == -1)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
return request->CheckDone();
|
||||
}
|
||||
|
||||
void Progress(int *total, int *done)
|
||||
void Progress(int64_t *total, int64_t *done)
|
||||
{
|
||||
if (!dead)
|
||||
{
|
||||
@ -188,7 +188,7 @@ static int http_request_progress(lua_State *l)
|
||||
auto *rh = (RequestHandle *)luaL_checkudata(l, 1, "HTTPRequest");
|
||||
if (!rh->Dead())
|
||||
{
|
||||
int total, done;
|
||||
int64_t total, done;
|
||||
rh->Progress(&total, &done);
|
||||
lua_pushinteger(l, total);
|
||||
lua_pushinteger(l, done);
|
||||
|
Loading…
Reference in New Issue
Block a user