Commit 9b44014d authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[5580] Do not use std::bind in boost async calls for unix sockets.

parent 3c22fede
// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -6,6 +6,7 @@
#include <asiolink/asio_wrapper.h>
#include <asiolink/unix_domain_socket.h>
#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <iostream>
using namespace boost::asio::local;
......@@ -161,11 +162,8 @@ public:
void
UnixDomainSocketImpl::asyncConnect(const stream_protocol::endpoint& endpoint,
const UnixDomainSocket::ConnectHandler& handler) {
using namespace std::placeholders;
UnixDomainSocket::ConnectHandler local_handler =
std::bind(&UnixDomainSocketImpl::connectHandler, shared_from_this(),
handler, _1);
auto local_handler = boost::bind(&UnixDomainSocketImpl::connectHandler, shared_from_this(),
handler, _1);
socket_.async_connect(endpoint, local_handler);
}
......@@ -193,11 +191,8 @@ UnixDomainSocketImpl::asyncSend(const void* data, const size_t length,
void
UnixDomainSocketImpl::doSend(const boost::asio::const_buffers_1& buffer,
const UnixDomainSocket::Handler& handler) {
using namespace std::placeholders;
UnixDomainSocket::Handler local_handler =
std::bind(&UnixDomainSocketImpl::sendHandler, shared_from_this(),
handler, buffer, _1, _2);
auto local_handler = boost::bind(&UnixDomainSocketImpl::sendHandler, shared_from_this(),
handler, buffer, _1, _2);
socket_.async_send(buffer, local_handler);
}
......@@ -228,11 +223,8 @@ UnixDomainSocketImpl::asyncReceive(void* data, const size_t length,
void
UnixDomainSocketImpl::doReceive(const boost::asio::mutable_buffers_1& buffer,
const UnixDomainSocket::Handler& handler) {
using namespace std::placeholders;
UnixDomainSocket::Handler local_handler =
std::bind(&UnixDomainSocketImpl::receiveHandler, shared_from_this(),
handler, buffer, _1, _2);
auto local_handler = boost::bind(&UnixDomainSocketImpl::receiveHandler, shared_from_this(),
handler, buffer, _1, _2);
socket_.async_receive(buffer, 0, local_handler);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment