Make code compatible with boost version 1.67

This commit is contained in:
loki 2019-12-04 23:54:32 +01:00
parent 31c0976e7a
commit 810ff31c0e

View File

@ -1,6 +1,13 @@
// //
// Created by loki on 6/5/19. // Created by loki on 6/5/19.
// //
#include <boost/version.hpp>
#if ((BOOST_VERSION / 1000) >= 107)
#define EXECUTOR(x) (x->get_executor())
#else
#define EXECUTOR(x) (x->get_io_service())
#endif
#include <queue> #include <queue>
#include <iostream> #include <iostream>
@ -458,7 +465,7 @@ std::optional<udp::endpoint> recv_peer(udp::socket &sock) {
udp::endpoint peer; udp::endpoint peer;
while (session.client_state > 0) { while (session.client_state > 0) {
asio::deadline_timer timer { sock.get_executor() }; asio::deadline_timer timer { EXECUTOR((&sock)) };
timer.expires_from_now(boost::posix_time::seconds(2)); timer.expires_from_now(boost::posix_time::seconds(2));
timer.async_wait([&](sys::error_code c){ timer.async_wait([&](sys::error_code c){
sock.cancel(); sock.cancel();