Skip to content

Commit

Permalink
update to the newer non-blocking and executor_type API
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvid Norberg committed Dec 14, 2017
1 parent 96e8e24 commit de7e1e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions include/simulator/simulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ All rights reserved.
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/write.hpp>
#include <boost/asio/read.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/system/error_code.hpp>

#include "simulator/pop_warnings.hpp"
Expand Down Expand Up @@ -158,8 +159,10 @@ namespace sim
{}

// io_control
using non_blocking_io = boost::asio::socket_base::non_blocking_io;
using reuse_address = boost::asio::socket_base::reuse_address;
#if BOOST_VERSION >= 106600
using executor_type = boost::asio::ip::tcp::socket::executor_type;
#endif

// socket options
using send_buffer_size = boost::asio::socket_base::send_buffer_size;
Expand Down Expand Up @@ -208,12 +211,12 @@ namespace sim
template <class IoControl>
void io_control(IoControl const&) {}

boost::system::error_code io_control(non_blocking_io const& ioc
boost::system::error_code non_blocking(bool b
, boost::system::error_code& ec)
{ m_non_blocking = ioc.get(); return ec; }
{ m_non_blocking = b; return ec; }

void io_control(non_blocking_io const& ioc)
{ m_non_blocking = ioc.get(); }
void non_blocking(bool b)
{ m_non_blocking = b; }

bool is_open() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/socks_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ namespace sim
}
else
{
m_udp_associate.io_control(udp::socket::non_blocking_io(true));
m_udp_associate.non_blocking(true);
m_udp_associate.async_receive_from(boost::asio::buffer(m_udp_buffer)
, m_udp_from, 0, std::bind(&socks_connection::on_read_udp, this, _1, _2));
}
Expand Down

0 comments on commit de7e1e3

Please sign in to comment.