make httpGet non-blocking

This commit is contained in:
MihailRis
2024-11-22 07:28:18 +03:00
parent 0fec17a8b6
commit 186078a8d5
2 changed files with 128 additions and 25 deletions
+8 -2
View File
@@ -18,10 +18,13 @@ namespace network {
virtual void get(
const std::string& url,
OnResponse onResponse,
OnReject onReject=nullptr
OnReject onReject=nullptr,
long maxSize=0
) = 0;
virtual size_t getTotalUpload() const = 0;
virtual size_t getTotalDownload() const = 0;
virtual void update() = 0;
};
class Socket {
@@ -55,7 +58,8 @@ namespace network {
void httpGet(
const std::string& url,
OnResponse onResponse,
OnReject onReject = nullptr
OnReject onReject = nullptr,
long maxSize=0
);
std::shared_ptr<Socket> connect(const std::string& address, int port);
@@ -63,6 +67,8 @@ namespace network {
size_t getTotalUpload() const;
size_t getTotalDownload() const;
void update();
static std::unique_ptr<Network> create(const NetworkSettings& settings);
};
}