mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
add 'data' argument to http error callback
This commit is contained in:
parent
20c5edb495
commit
7d6ddfa535
5 changed files with 35 additions and 37 deletions
|
|
@ -173,7 +173,7 @@ public:
|
|||
auto message = curl_multi_strerror(res);
|
||||
logger.error() << message << " (" << url << ")";
|
||||
if (onReject) {
|
||||
onReject(HTTP_BAD_GATEWAY);
|
||||
onReject(HTTP_BAD_GATEWAY, {});
|
||||
}
|
||||
url = "";
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
auto message = curl_multi_strerror(res);
|
||||
logger.error() << message << " (" << url << ")";
|
||||
if (onReject) {
|
||||
onReject(HTTP_BAD_GATEWAY);
|
||||
onReject(HTTP_BAD_GATEWAY, {});
|
||||
}
|
||||
curl_multi_remove_handle(multiHandle, curl);
|
||||
url = "";
|
||||
|
|
@ -213,9 +213,14 @@ public:
|
|||
onResponse(std::move(buffer));
|
||||
}
|
||||
} else {
|
||||
logger.error() << "response code " << response << " (" << url << ")";
|
||||
logger.error()
|
||||
<< "response code " << response << " (" << url << ")"
|
||||
<< (buffer.empty()
|
||||
? ""
|
||||
: std::to_string(buffer.size()) + " byte(s)");
|
||||
totalDownload += buffer.size();
|
||||
if (onReject) {
|
||||
onReject(response);
|
||||
onReject(response, std::move(buffer));
|
||||
}
|
||||
}
|
||||
url = "";
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
namespace network {
|
||||
using OnResponse = std::function<void(std::vector<char>)>;
|
||||
using OnReject = std::function<void(int)>;
|
||||
using OnReject = std::function<void(int, std::vector<char>)>;
|
||||
using ConnectCallback = std::function<void(u64id_t, u64id_t)>;
|
||||
using ServerDatagramCallback = std::function<void(u64id_t sid, const std::string& addr, int port, const char* buffer, size_t length)>;
|
||||
using ClientDatagramCallback = std::function<void(u64id_t cid, const char* buffer, size_t length)>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue