Skip to content
Snippets Groups Projects
Commit 33f9570e authored by Adrien Béraud's avatar Adrien Béraud
Browse files

adapt for Asio 1.34

parent c2d8b193
Branches
No related tags found
No related merge requests found
......@@ -456,7 +456,7 @@ Connection::set_ssl_verification(const std::string& hostname, const asio::ssl::v
}
// starts from CA and goes down the presented chain
auto verifier = asio::ssl::rfc2818_verification(hostname);
auto verifier = asio::ssl::host_name_verification(hostname);
bool verified = verifier(preverified, ctx);
auto verify_ec = X509_STORE_CTX_get_error(ctx.native_handle());
if (verify_ec != 0 /*X509_V_OK*/ and logger)
......@@ -591,12 +591,12 @@ Connection::async_write(BytesHandlerCb cb)
{
std::lock_guard<std::mutex> lock(mutex_);
if (!is_open()) {
if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
return;
}
if (ssl_socket_) asio::async_write(*ssl_socket_, write_buf_, wrapCallback(std::move(cb)));
else if (socket_) asio::async_write(*socket_, write_buf_, wrapCallback(std::move(cb)));
else if (cb) ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
else if (cb) asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
}
void
......@@ -604,12 +604,12 @@ Connection::async_read_until(const char* delim, BytesHandlerCb cb)
{
std::lock_guard<std::mutex> lock(mutex_);
if (!is_open()) {
if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
return;
}
if (ssl_socket_) asio::async_read_until(*ssl_socket_, read_buf_, delim, wrapCallback(std::move(cb)));
else if (socket_) asio::async_read_until(*socket_, read_buf_, delim, wrapCallback(std::move(cb)));
else if (cb) ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
else if (cb) asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
}
void
......@@ -617,12 +617,12 @@ Connection::async_read_until(char delim, BytesHandlerCb cb)
{
std::lock_guard<std::mutex> lock(mutex_);
if (!is_open()) {
if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
return;
}
if (ssl_socket_) asio::async_read_until(*ssl_socket_, read_buf_, delim, wrapCallback(std::move(cb)));
else if (socket_) asio::async_read_until(*socket_, read_buf_, delim, wrapCallback(std::move(cb)));
else if (cb) ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
else if (cb) asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
}
void
......@@ -630,12 +630,12 @@ Connection::async_read(size_t bytes, BytesHandlerCb cb)
{
std::lock_guard<std::mutex> lock(mutex_);
if (!is_open()) {
if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
return;
}
if (ssl_socket_) asio::async_read(*ssl_socket_, read_buf_, asio::transfer_exactly(bytes), wrapCallback(std::move(cb)));
else if (socket_) asio::async_read(*socket_, read_buf_, asio::transfer_exactly(bytes), wrapCallback(std::move(cb)));
else if (cb) ctx_.post([cb](){ cb(asio::error::operation_aborted, 0); });
else if (cb) asio::post(ctx_, [cb](){ cb(asio::error::operation_aborted, 0); });
}
void
......@@ -643,7 +643,7 @@ Connection::async_read_some(size_t bytes, BytesHandlerCb cb)
{
std::lock_guard<std::mutex> lock(mutex_);
if (!is_open()) {
if (cb) ctx_.post([cb](){ cb(asio::error::broken_pipe, 0); });
if (cb) asio::post(ctx_, [cb](){ cb(asio::error::broken_pipe, 0); });
return;
}
auto buf = read_buf_.prepare(bytes);
......
......@@ -97,7 +97,7 @@ PeerDiscovery::DomainPeerDiscovery::DomainPeerDiscovery(asio::ip::udp domain, in
, ioContext_(ioContext)
, peerDiscoveryTimer(*ioContext_)
, sockFd_(*ioContext_, domain)
, sockAddrSend_(asio::ip::address::from_string(domain.family() == AF_INET ? MULTICAST_ADDRESS_IPV4
, sockAddrSend_(asio::ip::make_address(domain.family() == AF_INET ? MULTICAST_ADDRESS_IPV4
: MULTICAST_ADDRESS_IPV6), port)
{
try {
......@@ -139,7 +139,7 @@ PeerDiscovery::DomainPeerDiscovery::startDiscovery(const std::string &type, Serv
callbackmap_[type] = callback;
if (not drunning_) {
drunning_ = true;
ioContext_->post([this] () {
asio::post(*ioContext_, [this] () {
loopListener();
query(sockAddrSend_);
});
......@@ -245,7 +245,7 @@ PeerDiscovery::DomainPeerDiscovery::startPublish(const std::string &type, const
messages_[type] = std::move(pack_buf_c);
reloadMessages();
lrunning_ = true;
ioContext_->post([this] () { publish(sockAddrSend_); });
asio::post(*ioContext_, [this] () { publish(sockAddrSend_); });
}
bool
......@@ -327,7 +327,7 @@ PeerDiscovery::DomainPeerDiscovery::reDiscover()
void
PeerDiscovery::DomainPeerDiscovery::connectivityChanged()
{
ioContext_->post([this] () {
asio::post(*ioContext_, [this] () {
reDiscover();
publish(sockAddrSend_);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment