You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
http_async_client() : sync_client(std::make_unique<http_client>()),
work_guard(asio::make_work_guard(ioc)) {
}
~http_async_client() {
work_guard.reset();
}
void start() {
worker = std::make_unique<std::thread>( [this]() {
ioc.run();
});
}
void stop() {
work_guard.reset();
worker->join();
}
// TODO: return result as future
template<typename T>
void post(const url& dest, const T& payload,
const time_point& deadline = time_point::maximum()) {
// Make sure only sync_client and these arguments (copied by value) are accessed from
// separate tread.
// T type could have pointers, but it doesn't make sense for payload to have them anyway.
asio::post( ioc.get_executor(), [this, dest, payload, deadline]() {
post_sync(dest, payload, deadline);
});
}
// TODO: implement. Add call_impl function which could be used by post as well as these.
+#pragma once
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/use_future.hpp>
#include <fc/variant.hpp>
#include <fc/reflect/variant.hpp>
#include <fc/time.hpp>
#include <fc/network/http/http_client.hpp>
#include
namespace eosio {
using namespace fc;
namespace asio = boost::asio;
template
struct final_action {
final_action(F f) : clean{f} {}
~final_action() { clean(); }
private:
F clean;
};
template
final_action finally(F f) {
return final_action(f);
}
class http_async_client {
public:
// void add_cert(const std::string& cert_pem_string);
// void set_verify_peers(bool enabled);
private:
template
void post_sync(const url& dest, const T& payload,
const time_point& deadline = time_point::maximum()) {
};
}
The text was updated successfully, but these errors were encountered: