Skip to content

Commit

Permalink
Merge pull request #577 from redboltz/impl_575
Browse files Browse the repository at this point in the history
Implemented #575.
  • Loading branch information
redboltz authored Jan 9, 2020
2 parents 8fb8a12 + 8676495 commit 9d078a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/mqtt/tcp_endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ class tcp_endpoint {
return tcp_.lowest_layer();
}

typename Socket::native_handle_type native_handle() {
return tcp_.native_handle();
}

template <typename... Args>
void set_option(Args&& ... args) {
tcp_.set_option(std::forward<Args>(args)...);
Expand Down
3 changes: 3 additions & 0 deletions include/mqtt/type_erased_socket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <mqtt/namespace.hpp>
#include <mqtt/shared_any.hpp>
#include <mqtt/error_code.hpp>
#include <mqtt/any.hpp>

// I intentionally use old style boost type_erasure member fucntion concept definition.
// The new style requires compiler extension.
Expand All @@ -27,6 +28,7 @@ BOOST_TYPE_ERASURE_MEMBER((MQTT_NS)(has_async_write), async_write, 3)
BOOST_TYPE_ERASURE_MEMBER((MQTT_NS)(has_write), write, 2)
BOOST_TYPE_ERASURE_MEMBER((MQTT_NS)(has_post), post, 1)
BOOST_TYPE_ERASURE_MEMBER((MQTT_NS)(has_lowest_layer), lowest_layer, 0)
BOOST_TYPE_ERASURE_MEMBER((MQTT_NS)(has_native_handle), native_handle, 0)
BOOST_TYPE_ERASURE_MEMBER((MQTT_NS)(has_close), close, 1)
BOOST_TYPE_ERASURE_MEMBER((MQTT_NS)(has_get_executor), get_executor, 0)

Expand All @@ -52,6 +54,7 @@ using socket = shared_any<
has_write<std::size_t(std::vector<as::const_buffer>, boost::system::error_code&)>,
has_post<void(std::function<void()>)>,
has_lowest_layer<as::ip::tcp::socket::lowest_layer_type&()>,
has_native_handle<any()>,
has_close<void(boost::system::error_code&)>,
has_get_executor<as::executor()>
>
Expand Down
4 changes: 4 additions & 0 deletions include/mqtt/ws_endpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class ws_endpoint {
return ws_.next_layer();
}

auto native_handle() {
return next_layer().native_handle();
}

template <typename T>
void set_option(T&& t) {
ws_.set_option(std::forward<T>(t));
Expand Down

0 comments on commit 9d078a3

Please sign in to comment.