system ifdefs
This commit is contained in:
parent
d2c6f597d2
commit
457a5d4a65
@ -104,6 +104,7 @@ OctoPrint::OctoPrint(DynamicPrintConfig *config) :
|
|||||||
|
|
||||||
const char* OctoPrint::get_name() const { return "OctoPrint"; }
|
const char* OctoPrint::get_name() const { return "OctoPrint"; }
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
bool OctoPrint::test_with_resolved_ip(wxString &msg) const
|
bool OctoPrint::test_with_resolved_ip(wxString &msg) const
|
||||||
{
|
{
|
||||||
// Since the request is performed synchronously here,
|
// Since the request is performed synchronously here,
|
||||||
@ -153,6 +154,7 @@ bool OctoPrint::test_with_resolved_ip(wxString &msg) const
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
#endif //WIN32
|
||||||
|
|
||||||
bool OctoPrint::test(wxString& msg) const
|
bool OctoPrint::test(wxString& msg) const
|
||||||
{
|
{
|
||||||
@ -227,8 +229,7 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
|
|||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
return upload_inner_with_host(upload_data, prorgess_fn, error_fn);
|
return upload_inner_with_host(upload_data, prorgess_fn, error_fn);
|
||||||
#endif // !WIN32
|
#else
|
||||||
|
|
||||||
// decide what to do based on m_host - resolve hostname or upload to ip
|
// decide what to do based on m_host - resolve hostname or upload to ip
|
||||||
std::vector<boost::asio::ip::address> resolved_addr;
|
std::vector<boost::asio::ip::address> resolved_addr;
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
@ -254,9 +255,11 @@ bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Erro
|
|||||||
BOOST_LOG_TRIVIAL(error) << "PrusaSlicer failed to resolve hostname " << m_host << " into the IP address. Starting upload with system resolving.";
|
BOOST_LOG_TRIVIAL(error) << "PrusaSlicer failed to resolve hostname " << m_host << " into the IP address. Starting upload with system resolving.";
|
||||||
return false;//upload_inner_with_host(upload_data, prorgess_fn, error_fn);
|
return false;//upload_inner_with_host(upload_data, prorgess_fn, error_fn);
|
||||||
}
|
}
|
||||||
return upload_inner(upload_data, prorgess_fn, error_fn, resolved_addr);
|
return upload_inner_with_resolved_ip(upload_data, prorgess_fn, error_fn, resolved_addr);
|
||||||
|
#endif // WIN32
|
||||||
}
|
}
|
||||||
bool OctoPrint::upload_inner(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, const std::vector<boost::asio::ip::address>& resolved_addr) const
|
#ifdef WIN32
|
||||||
|
bool OctoPrint::upload_inner_with_resolved_ip(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, const std::vector<boost::asio::ip::address>& resolved_addr) const
|
||||||
{
|
{
|
||||||
wxString error_message;
|
wxString error_message;
|
||||||
for each (const auto& ip in resolved_addr) {
|
for each (const auto& ip in resolved_addr) {
|
||||||
@ -305,9 +308,7 @@ bool OctoPrint::upload_inner(PrintHostUpload upload_data, ProgressFn prorgess_fn
|
|||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
#ifdef WIN32
|
|
||||||
.ssl_revoke_best_effort(m_ssl_revoke_best_effort)
|
.ssl_revoke_best_effort(m_ssl_revoke_best_effort)
|
||||||
#endif
|
|
||||||
.perform_sync();
|
.perform_sync();
|
||||||
if (result)
|
if (result)
|
||||||
return true;
|
return true;
|
||||||
@ -316,6 +317,7 @@ bool OctoPrint::upload_inner(PrintHostUpload upload_data, ProgressFn prorgess_fn
|
|||||||
error_fn(std::move(error_message));
|
error_fn(std::move(error_message));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif //WIN32
|
||||||
|
|
||||||
bool OctoPrint::upload_inner_with_host(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
bool OctoPrint::upload_inner_with_host(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const
|
||||||
{
|
{
|
||||||
|
@ -36,8 +36,10 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool validate_version_text(const boost::optional<std::string> &version_text) const;
|
virtual bool validate_version_text(const boost::optional<std::string> &version_text) const;
|
||||||
virtual bool upload_inner(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, const std::vector<boost::asio::ip::address>& resolved_addr) const;
|
#ifdef WIN32
|
||||||
|
virtual bool upload_inner_with_resolved_ip(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, const std::vector<boost::asio::ip::address>& resolved_addr) const;
|
||||||
virtual bool test_with_resolved_ip(wxString& curl_msg) const;
|
virtual bool test_with_resolved_ip(wxString& curl_msg) const;
|
||||||
|
#endif
|
||||||
virtual bool upload_inner_with_host(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const;
|
virtual bool upload_inner_with_host(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user