mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
make httpGet non-blocking
This commit is contained in:
parent
0fec17a8b6
commit
186078a8d5
2 changed files with 128 additions and 25 deletions
|
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue