Skip to content

Commit

Permalink
Strip out some code to support Boost <1.70
Browse files Browse the repository at this point in the history
The minimum version that works is 1.70, so this code is no longer
useful.
  • Loading branch information
bmerry committed Jan 7, 2025
1 parent ca8b08f commit a2af437
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
23 changes: 1 addition & 22 deletions include/spead2/common_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,6 @@ void set_socket_send_buffer_size(SocketType &socket, std::size_t buffer_size);
template<typename SocketType>
void set_socket_recv_buffer_size(SocketType &socket, std::size_t buffer_size);

#if BOOST_VERSION >= 107000
/**
* Get an object suitable for constructing another socket with the same IO
* context. The return type depends on the Boost version. This is necessary
* because Boost 1.70 removed @c basic_socket::get_io_context.
*/
template<typename SocketType>
static inline typename SocketType::executor_type get_socket_executor(SocketType &socket)
{
return socket.get_executor();
}
#else
template<typename SocketType>
static inline boost::asio::io_context &get_socket_executor(SocketType &socket)
{
return socket.get_io_context();
}
#endif

/**
* Determine whether a socket is using a particular IO context. This is necessary
* because Boost 1.70 removed @c basic_socket::get_io_context.
Expand All @@ -82,10 +63,8 @@ static inline bool socket_uses_io_context(SocketType &socket, boost::asio::io_co
typedef boost::asio::io_context::executor_type executor_type;
return socket.get_executor().target_type() == typeid(executor_type)
&& *socket.get_executor().template target<executor_type>() == io_context.get_executor();
#elif BOOST_VERSION >= 107000
return socket.get_executor() == io_context.get_executor();
#else
return &socket.get_io_context() == &io_context;
return socket.get_executor() == io_context.get_executor();
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion src/recv_tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tcp_reader::tcp_reader(
buffer(new std::uint8_t[max_size * pkts_per_buffer]),
head(buffer.get()),
tail(buffer.get()),
peer(get_socket_executor(acceptor)),
peer(acceptor.get_executor()),
acceptor(std::move(acceptor))
{
assert(socket_uses_io_context(this->acceptor, get_io_context()));
Expand Down

0 comments on commit a2af437

Please sign in to comment.