mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-06 07:11:10 +00:00
Merge branch 'main' into feat/printer-agent-impl
This commit is contained in:
@@ -1,7 +1,23 @@
|
||||
#include "Http.hpp"
|
||||
#include "libslic3r_version.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <curl/curlver.h>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <ios>
|
||||
#include "libslic3r/Exception.hpp"
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <thread>
|
||||
#include <deque>
|
||||
#include <sstream>
|
||||
@@ -13,6 +29,7 @@
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <utility>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/ssl.h>
|
||||
@@ -133,7 +150,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;
|
||||
@@ -271,9 +288,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)
|
||||
@@ -484,7 +501,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;
|
||||
@@ -795,7 +812,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