mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-06 07:11:10 +00:00
feat: add foundation for configurable printer agent connection (#16027)
* feat: add foundation for configurable printer agent connection * fix: regression after merge * chore: remove duplcate http include * fix: remove unrelated moonraker.cpp changes * chore: port add_platform_root_certificates to 15711 * fix: clean diff
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "Http.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <thread>
|
||||
@@ -122,7 +123,7 @@ struct Http::priv
|
||||
std::string error_buffer; // Used for CURLOPT_ERRORBUFFER
|
||||
std::string headers;
|
||||
size_t limit;
|
||||
bool cancel;
|
||||
std::atomic_bool cancel;
|
||||
std::unique_ptr<form_file> putFile;
|
||||
|
||||
std::thread io_thread;
|
||||
@@ -260,9 +261,9 @@ int Http::priv::xfercb(void *userp, curl_off_t dltotal, curl_off_t dlnow, curl_o
|
||||
self->progressfn(progress, cb_cancel);
|
||||
}
|
||||
|
||||
if (cb_cancel) { self->cancel = true; }
|
||||
if (cb_cancel) { self->cancel.store(true); }
|
||||
|
||||
return self->cancel;
|
||||
return self->cancel.load();
|
||||
}
|
||||
|
||||
int Http::priv::xfercb_legacy(void *userp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
@@ -473,7 +474,7 @@ void Http::priv::http_perform()
|
||||
|
||||
if (res != CURLE_OK) {
|
||||
if (res == CURLE_ABORTED_BY_CALLBACK) {
|
||||
if (cancel) {
|
||||
if (cancel.load()) {
|
||||
// The abort comes from the request being cancelled programatically
|
||||
Progress dummyprogress(0, 0, 0, 0, std::string());
|
||||
bool cancel = true;
|
||||
@@ -784,7 +785,7 @@ void Http::perform_sync()
|
||||
|
||||
void Http::cancel()
|
||||
{
|
||||
if (p) { p->cancel = true; }
|
||||
if (p) { p->cancel.store(true); }
|
||||
}
|
||||
|
||||
void Http::print() const
|
||||
|
||||
Reference in New Issue
Block a user