From 83493c83d99b843124cfd74dcc13815f513a454b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Korina=20=C5=A0imi=C4=8Devi=C4=87?= Date: Fri, 6 Oct 2023 11:51:04 +0200 Subject: [PATCH] [mqtt client&test] #includes housekeeping Summary: resolves T12777 Reviewers: ivica Reviewed By: ivica Subscribers: miljen Maniphest Tasks: T12777 Differential Revision: https://repo.mireo.local/D25995 --- example/openssl-tls.cpp | 7 ++-- example/tcp.cpp | 2 +- example/websocket-tcp.cpp | 2 + example/websocket-tls.cpp | 6 ++- include/async_mqtt5/detail/async_mutex.hpp | 10 ++--- include/async_mqtt5/detail/async_traits.hpp | 16 +++----- .../detail/cancellable_handler.hpp | 13 +++--- include/async_mqtt5/detail/control_packet.hpp | 1 - include/async_mqtt5/detail/internal_types.hpp | 1 + include/async_mqtt5/impl/assemble_op.hpp | 12 ++++-- include/async_mqtt5/impl/async_sender.hpp | 1 + .../async_mqtt5/impl/autoconnect_stream.hpp | 8 +--- include/async_mqtt5/impl/client_service.hpp | 28 ++++++------- include/async_mqtt5/impl/connect_op.hpp | 24 +++++------ include/async_mqtt5/impl/disconnect_op.hpp | 13 +++--- include/async_mqtt5/impl/endpoints.hpp | 11 +++-- .../async_mqtt5/impl/internal/alloc/memory.h | 3 -- .../impl/internal/codecs/base_decoders.hpp | 3 +- .../impl/internal/codecs/base_encoders.hpp | 2 + .../impl/internal/codecs/message_decoders.hpp | 1 + .../impl/internal/codecs/message_encoders.hpp | 1 + include/async_mqtt5/impl/ping_op.hpp | 6 +-- include/async_mqtt5/impl/publish_rec_op.hpp | 18 +++++---- include/async_mqtt5/impl/publish_send_op.hpp | 12 +++--- include/async_mqtt5/impl/read_message_op.hpp | 9 ++++- include/async_mqtt5/impl/read_op.hpp | 4 +- include/async_mqtt5/impl/reconnect_op.hpp | 8 +++- include/async_mqtt5/impl/replies.hpp | 9 ++--- include/async_mqtt5/impl/sentry_op.hpp | 7 +++- include/async_mqtt5/impl/subscribe_op.hpp | 7 ++-- include/async_mqtt5/impl/unsubscribe_op.hpp | 14 +++---- include/async_mqtt5/impl/write_op.hpp | 3 +- include/async_mqtt5/mqtt_client.hpp | 7 +++- include/async_mqtt5/types.hpp | 4 +- test/unit/include/test_common/delayed_op.hpp | 3 +- .../include/test_common/message_exchange.hpp | 6 --- test/unit/include/test_common/packet_util.hpp | 5 ++- test/unit/include/test_common/test_broker.hpp | 6 +-- .../unit/include/test_common/test_service.hpp | 13 +++--- test/unit/include/test_common/test_stream.hpp | 7 ++-- test/unit/src/run_tests.cpp | 1 + test/unit/test/client_broker.cpp | 9 +++-- test/unit/test/coroutine.cpp | 4 +- test/unit/test/publish_send_op.cpp | 1 + test/unit/test/serialization.cpp | 1 + win/mqtt-client.vcxproj | 2 +- win/mqtt-client.vcxproj.filters | 6 +-- win/test/mqtt-test.vcxproj | 14 +++---- win/test/mqtt-test.vcxproj.filters | 40 +++++++++---------- 49 files changed, 204 insertions(+), 187 deletions(-) diff --git a/example/openssl-tls.cpp b/example/openssl-tls.cpp index 309ee44..977687e 100644 --- a/example/openssl-tls.cpp +++ b/example/openssl-tls.cpp @@ -1,11 +1,12 @@ #include -#include -#include -#include #include +#include +#include #include +#include + #include namespace asio = boost::asio; diff --git a/example/tcp.cpp b/example/tcp.cpp index 41ed11f..610ab3c 100644 --- a/example/tcp.cpp +++ b/example/tcp.cpp @@ -1,7 +1,7 @@ #include -#include #include + #include #include diff --git a/example/websocket-tcp.cpp b/example/websocket-tcp.cpp index 011c52d..defcfba 100644 --- a/example/websocket-tcp.cpp +++ b/example/websocket-tcp.cpp @@ -1,7 +1,9 @@ #include #include + #include + #include #include diff --git a/example/websocket-tls.cpp b/example/websocket-tls.cpp index 09b7150..1e1982c 100644 --- a/example/websocket-tls.cpp +++ b/example/websocket-tls.cpp @@ -1,10 +1,12 @@ #include #include -#include -#include #include +#include + +#include + #include namespace asio = boost::asio; diff --git a/include/async_mqtt5/detail/async_mutex.hpp b/include/async_mqtt5/detail/async_mutex.hpp index adcb962..23a134f 100644 --- a/include/async_mqtt5/detail/async_mutex.hpp +++ b/include/async_mqtt5/detail/async_mutex.hpp @@ -1,12 +1,10 @@ #ifndef ASYNC_MQTT5_ASYNC_MUTEX_HPP #define ASYNC_MQTT5_ASYNC_MUTEX_HPP -#include -#include -#include -#include -#include #include +#include +#include +#include #include #include @@ -25,7 +23,7 @@ private: using queued_op_t = asio::any_completion_handler< void (boost::system::error_code) >; - using queue_t = detail::ring_buffer; + using queue_t = ring_buffer; // Handler with assigned tracking executor. // Objects of this type are type-erased by any_completion_handler diff --git a/include/async_mqtt5/detail/async_traits.hpp b/include/async_mqtt5/detail/async_traits.hpp index a2cc964..4600e69 100644 --- a/include/async_mqtt5/detail/async_traits.hpp +++ b/include/async_mqtt5/detail/async_traits.hpp @@ -4,13 +4,13 @@ #include #include -#include +#include #include #include -#include + #include -#include +#include namespace async_mqtt5 { @@ -44,7 +44,7 @@ template concept has_async_write = requires(T a) { a.async_write( std::declval(), - [](boost::system::error_code, size_t) {} + [](error_code, size_t) {} ); }; @@ -144,14 +144,10 @@ decltype(auto) async_write( template void setup_tls_sni(const authority_path& ap, TlsContext& ctx, Stream& s) { - if constexpr (has_tls_handshake) { - using tls_stream_type = Stream; + if constexpr (has_tls_handshake) assign_tls_sni(ap, ctx, s); - } - else if constexpr (has_next_layer) { - using next_layer_type = typename Stream::next_layer_type; + else if constexpr (has_next_layer) setup_tls_sni(ap, ctx, next_layer(s)); - } } } // end namespace detail diff --git a/include/async_mqtt5/detail/cancellable_handler.hpp b/include/async_mqtt5/detail/cancellable_handler.hpp index 9eb7294..0f8f7be 100644 --- a/include/async_mqtt5/detail/cancellable_handler.hpp +++ b/include/async_mqtt5/detail/cancellable_handler.hpp @@ -1,16 +1,15 @@ #ifndef ASYNC_MQTT5_CANCELLABLE_HANDLER_HPP #define ASYNC_MQTT5_CANCELLABLE_HANDLER_HPP -#include +#include + #include #include -#include -#include -#include -#include +#include #include -#include -#include +#include +#include +#include #include diff --git a/include/async_mqtt5/detail/control_packet.hpp b/include/async_mqtt5/detail/control_packet.hpp index 95b8b26..4159fac 100644 --- a/include/async_mqtt5/detail/control_packet.hpp +++ b/include/async_mqtt5/detail/control_packet.hpp @@ -10,7 +10,6 @@ namespace async_mqtt5 { -namespace asio = boost::asio; enum class control_code_e : std::uint8_t { no_packet = 0b00000000, // 0 diff --git a/include/async_mqtt5/detail/internal_types.hpp b/include/async_mqtt5/detail/internal_types.hpp index e66df83..9355601 100644 --- a/include/async_mqtt5/detail/internal_types.hpp +++ b/include/async_mqtt5/detail/internal_types.hpp @@ -4,6 +4,7 @@ #include #include +#include #include namespace async_mqtt5::detail { diff --git a/include/async_mqtt5/impl/assemble_op.hpp b/include/async_mqtt5/impl/assemble_op.hpp index b7c3250..310a0fb 100644 --- a/include/async_mqtt5/impl/assemble_op.hpp +++ b/include/async_mqtt5/impl/assemble_op.hpp @@ -1,16 +1,20 @@ #ifndef ASYNC_MQTT5_ASSEMBLE_OP_HPP #define ASYNC_MQTT5_ASSEMBLE_OP_HPP +#include + +#include #include +#include +#include #include #include -#include -#include -#include #include -#include + #include +#include + #include #include diff --git a/include/async_mqtt5/impl/async_sender.hpp b/include/async_mqtt5/impl/async_sender.hpp index 99e2061..2939ace 100644 --- a/include/async_mqtt5/impl/async_sender.hpp +++ b/include/async_mqtt5/impl/async_sender.hpp @@ -4,6 +4,7 @@ #include #include #include + #include #include diff --git a/include/async_mqtt5/impl/autoconnect_stream.hpp b/include/async_mqtt5/impl/autoconnect_stream.hpp index 3aa99e2..f9c7b92 100644 --- a/include/async_mqtt5/impl/autoconnect_stream.hpp +++ b/include/async_mqtt5/impl/autoconnect_stream.hpp @@ -3,24 +3,20 @@ #include -#include -#include -#include -#include #include -#include #include #include #include -#include #include +#include #include namespace async_mqtt5::detail { namespace asio = boost::asio; +using error_code = boost::system::error_code; template < typename StreamType, diff --git a/include/async_mqtt5/impl/client_service.hpp b/include/async_mqtt5/impl/client_service.hpp index c53c369..65ce9f2 100644 --- a/include/async_mqtt5/impl/client_service.hpp +++ b/include/async_mqtt5/impl/client_service.hpp @@ -3,18 +3,18 @@ #include -#include #include -#include -#include -#include #include +#include +#include #include +#include #include namespace async_mqtt5::detail { +namespace asio = boost::asio; template class stream_context; @@ -95,8 +95,8 @@ template < typename TlsContext = std::monostate > class client_service { - using stream_context_type = detail::stream_context; - using stream_type = detail::autoconnect_stream< + using stream_context_type = stream_context; + using stream_type = autoconnect_stream< StreamType, stream_context_type >; public: @@ -108,26 +108,26 @@ private: >; template - friend class detail::async_sender; + friend class async_sender; template - friend class detail::assemble_op; + friend class assemble_op; template - friend class detail::ping_op; + friend class ping_op; template - friend class detail::sentry_op; + friend class sentry_op; stream_context_type _stream_context; stream_type _stream; packet_id_allocator _pid_allocator; - detail::replies _replies; - detail::async_sender _async_sender; + replies _replies; + async_sender _async_sender; std::string _read_buff; - detail::data_span _active_span; + data_span _active_span; receive_channel _rec_channel; @@ -231,7 +231,7 @@ public: template decltype(auto) async_assemble(duration wait_for, CompletionToken&& token) { auto initiation = [this] (auto handler, duration wait_for) mutable { - detail::assemble_op { + assemble_op { *this, std::move(handler), _read_buff, _active_span }.perform(wait_for, asio::transfer_at_least(0)); diff --git a/include/async_mqtt5/impl/connect_op.hpp b/include/async_mqtt5/impl/connect_op.hpp index 01d38e4..692b26f 100644 --- a/include/async_mqtt5/impl/connect_op.hpp +++ b/include/async_mqtt5/impl/connect_op.hpp @@ -1,26 +1,26 @@ #ifndef ASYNC_MQTT5_CONNECT_OP_HPP #define ASYNC_MQTT5_CONNECT_OP_HPP -#include -#include -#include #include +#include #include +#include #include -#include #include #include +#include + #include -#include #include #include +#include #include -#include #include +#include namespace async_mqtt5::detail { @@ -71,7 +71,7 @@ public: } void perform( - const connect_op::epoints& eps, authority_path ap + const epoints& eps, authority_path ap ) { lowest_layer(_stream).async_connect( *std::begin(eps), @@ -83,7 +83,7 @@ public: } void operator()( - on_connect, error_code ec, connect_op::endpoint ep, authority_path ap + on_connect, error_code ec, endpoint ep, authority_path ap ) { if (ec) return complete(ec); @@ -91,7 +91,7 @@ public: do_tls_handshake(std::move(ep), std::move(ap)); } - void do_tls_handshake(connect_op::endpoint ep, authority_path ap) { + void do_tls_handshake(endpoint ep, authority_path ap) { if constexpr (has_tls_handshake) { _stream.async_handshake( tls_handshake_type::client, @@ -116,7 +116,7 @@ public: void operator()( on_tls_handshake, error_code ec, - connect_op::endpoint ep, authority_path ap + endpoint ep, authority_path ap ) { if (ec) return complete(ec); @@ -124,7 +124,7 @@ public: do_ws_handshake(std::move(ep), std::move(ap)); } - void do_ws_handshake(connect_op::endpoint ep, authority_path ap) { + void do_ws_handshake(endpoint ep, authority_path ap) { if constexpr (has_ws_handshake) { using namespace boost::beast; @@ -173,7 +173,7 @@ public: const auto& wire_data = packet.wire_data(); - async_mqtt5::detail::async_write( + detail::async_write( _stream, asio::buffer(wire_data), asio::consign( asio::prepend(std::move(*this), on_send_connect{}), diff --git a/include/async_mqtt5/impl/disconnect_op.hpp b/include/async_mqtt5/impl/disconnect_op.hpp index cc3391e..5e32f79 100644 --- a/include/async_mqtt5/impl/disconnect_op.hpp +++ b/include/async_mqtt5/impl/disconnect_op.hpp @@ -1,14 +1,15 @@ #ifndef ASYNC_MQTT5_DISCONNECT_OP_HPP #define ASYNC_MQTT5_DISCONNECT_OP_HPP -#include #include #include +#include #include -#include + #include #include + #include namespace async_mqtt5::detail { @@ -119,18 +120,18 @@ decltype(auto) async_disconnect( using Signature = void (error_code); auto initiate = []( - auto handler, detail::disconnect_context ctx, bool terminal, + auto handler, disconnect_context ctx, const std::shared_ptr& svc_ptr ) { - detail::disconnect_op { + disconnect_op { svc_ptr, std::move(ctx), std::move(handler) }.perform(); }; return asio::async_initiate( std::move(initiate), token, - detail::disconnect_context { reason_code, props, terminal }, - terminal, svc_ptr + disconnect_context { reason_code, props, terminal }, + svc_ptr ); } diff --git a/include/async_mqtt5/impl/endpoints.hpp b/include/async_mqtt5/impl/endpoints.hpp index 4b4b1d8..f2c65af 100644 --- a/include/async_mqtt5/impl/endpoints.hpp +++ b/include/async_mqtt5/impl/endpoints.hpp @@ -1,16 +1,19 @@ #ifndef ASYNC_MQTT5_ENDPOINTS_HPP #define ASYNC_MQTT5_ENDPOINTS_HPP -#include -#include #include #include +#include +#include +#include + #include +#include + #include -#include -#include +#include namespace async_mqtt5::detail { diff --git a/include/async_mqtt5/impl/internal/alloc/memory.h b/include/async_mqtt5/impl/internal/alloc/memory.h index bb1505c..5b03e3b 100644 --- a/include/async_mqtt5/impl/internal/alloc/memory.h +++ b/include/async_mqtt5/impl/internal/alloc/memory.h @@ -1,9 +1,6 @@ #ifndef ASYNC_MQTT5_MEMORY_H #define ASYNC_MQTT5_MEMORY_H -#include -#include - #include "memory_resource.h" namespace pma { diff --git a/include/async_mqtt5/impl/internal/codecs/base_decoders.hpp b/include/async_mqtt5/impl/internal/codecs/base_decoders.hpp index c26ca97..9efdb39 100644 --- a/include/async_mqtt5/impl/internal/codecs/base_decoders.hpp +++ b/include/async_mqtt5/impl/internal/codecs/base_decoders.hpp @@ -3,11 +3,12 @@ #include #include + #include #include -#include +#include namespace async_mqtt5::decoders { diff --git a/include/async_mqtt5/impl/internal/codecs/base_encoders.hpp b/include/async_mqtt5/impl/internal/codecs/base_encoders.hpp index 2dba2bd..123544d 100644 --- a/include/async_mqtt5/impl/internal/codecs/base_encoders.hpp +++ b/include/async_mqtt5/impl/internal/codecs/base_encoders.hpp @@ -3,9 +3,11 @@ #include #include + #include #include + #include namespace async_mqtt5::encoders { diff --git a/include/async_mqtt5/impl/internal/codecs/message_decoders.hpp b/include/async_mqtt5/impl/internal/codecs/message_decoders.hpp index 3062e52..9d5dbce 100644 --- a/include/async_mqtt5/impl/internal/codecs/message_decoders.hpp +++ b/include/async_mqtt5/impl/internal/codecs/message_decoders.hpp @@ -5,6 +5,7 @@ #include #include + #include #include diff --git a/include/async_mqtt5/impl/internal/codecs/message_encoders.hpp b/include/async_mqtt5/impl/internal/codecs/message_encoders.hpp index 464b1ab..3418f3e 100644 --- a/include/async_mqtt5/impl/internal/codecs/message_encoders.hpp +++ b/include/async_mqtt5/impl/internal/codecs/message_encoders.hpp @@ -5,6 +5,7 @@ #include #include + #include #include diff --git a/include/async_mqtt5/impl/ping_op.hpp b/include/async_mqtt5/impl/ping_op.hpp index 7285f54..f3d97bc 100644 --- a/include/async_mqtt5/impl/ping_op.hpp +++ b/include/async_mqtt5/impl/ping_op.hpp @@ -4,14 +4,14 @@ #include #include -#include #include +#include #include -#include #include -#include #include +#include + #include namespace async_mqtt5::detail { diff --git a/include/async_mqtt5/impl/publish_rec_op.hpp b/include/async_mqtt5/impl/publish_rec_op.hpp index d63f81b..381613e 100644 --- a/include/async_mqtt5/impl/publish_rec_op.hpp +++ b/include/async_mqtt5/impl/publish_rec_op.hpp @@ -2,19 +2,21 @@ #define ASYNC_MQTT5_PUBLISH_REC_OP_HPP #include -#include + +#include #include -#include -#include +#include +#include #include - #include -#include + #include +#include + #include -#include #include +#include namespace async_mqtt5::detail { @@ -69,7 +71,7 @@ public: auto puback = control_packet::of( with_pid, get_allocator(), encoders::encode_puback, *packet_id, - uint8_t(0), puback_props{} + uint8_t(0), puback_props {} ); return send_puback(std::move(puback)); } @@ -78,7 +80,7 @@ public: auto pubrec = control_packet::of( with_pid, get_allocator(), encoders::encode_pubrec, *packet_id, - uint8_t(0), pubrec_props{} + uint8_t(0), pubrec_props {} ); return send_pubrec(std::move(pubrec)); diff --git a/include/async_mqtt5/impl/publish_send_op.hpp b/include/async_mqtt5/impl/publish_send_op.hpp index 623cbba..2b7f19d 100644 --- a/include/async_mqtt5/impl/publish_send_op.hpp +++ b/include/async_mqtt5/impl/publish_send_op.hpp @@ -2,18 +2,18 @@ #define ASYNC_MQTT5_PUBLISH_SEND_OP_HPP #include +#include #include +#include -#include -#include -#include #include - -#include -#include +#include +#include #include +#include +#include namespace async_mqtt5::detail { diff --git a/include/async_mqtt5/impl/read_message_op.hpp b/include/async_mqtt5/impl/read_message_op.hpp index f1fb4a2..fddb544 100644 --- a/include/async_mqtt5/impl/read_message_op.hpp +++ b/include/async_mqtt5/impl/read_message_op.hpp @@ -7,10 +7,13 @@ #include #include + #include -#include -#include + #include +#include + +#include namespace async_mqtt5::detail { @@ -76,6 +79,7 @@ public: private: + // TODO: ec & packet_id are not used here void dispatch( error_code ec, uint16_t packet_id, uint8_t control_byte, byte_citer first, byte_citer last @@ -106,6 +110,7 @@ private: } break; } + perform(); } diff --git a/include/async_mqtt5/impl/read_op.hpp b/include/async_mqtt5/impl/read_op.hpp index 9b28e8e..dfff235 100644 --- a/include/async_mqtt5/impl/read_op.hpp +++ b/include/async_mqtt5/impl/read_op.hpp @@ -1,8 +1,9 @@ #ifndef ASYNC_MQTT5_READ_OP_HPP #define ASYNC_MQTT5_READ_OP_HPP -#include #include +#include + #include #include @@ -57,7 +58,6 @@ public: asioex::wait_for_one(), asio::prepend(std::move(*this), on_read {}, stream_ptr) ); - } else (*this)( diff --git a/include/async_mqtt5/impl/reconnect_op.hpp b/include/async_mqtt5/impl/reconnect_op.hpp index c43cbc7..c567f78 100644 --- a/include/async_mqtt5/impl/reconnect_op.hpp +++ b/include/async_mqtt5/impl/reconnect_op.hpp @@ -1,14 +1,18 @@ #ifndef ASYNC_MQTT5_RECONNECT_OP_HPP #define ASYNC_MQTT5_RECONNECT_OP_HPP -#include -#include #include +#include +#include + #include + #include #include + #include + #include namespace async_mqtt5::detail { diff --git a/include/async_mqtt5/impl/replies.hpp b/include/async_mqtt5/impl/replies.hpp index f755643..2a470e6 100644 --- a/include/async_mqtt5/impl/replies.hpp +++ b/include/async_mqtt5/impl/replies.hpp @@ -1,16 +1,13 @@ #ifndef ASYNC_MQTT5_REPLIES_HPP #define ASYNC_MQTT5_REPLIES_HPP -#include #include -#include -#include #include - -#include -#include +#include +#include #include +#include namespace async_mqtt5::detail { diff --git a/include/async_mqtt5/impl/sentry_op.hpp b/include/async_mqtt5/impl/sentry_op.hpp index 22719f1..9881d2f 100644 --- a/include/async_mqtt5/impl/sentry_op.hpp +++ b/include/async_mqtt5/impl/sentry_op.hpp @@ -1,14 +1,17 @@ #ifndef ASYNC_MQTT5_SENTRY_OP_HPP #define ASYNC_MQTT5_SENTRY_OP_HPP +#include #include -#include #include -#include +#include #include +#include #include +#include + namespace async_mqtt5::detail { namespace asio = boost::asio; diff --git a/include/async_mqtt5/impl/subscribe_op.hpp b/include/async_mqtt5/impl/subscribe_op.hpp index c56a7e5..c277f65 100644 --- a/include/async_mqtt5/impl/subscribe_op.hpp +++ b/include/async_mqtt5/impl/subscribe_op.hpp @@ -5,13 +5,12 @@ #include -#include -#include -#include #include +#include +#include -#include #include +#include #include diff --git a/include/async_mqtt5/impl/unsubscribe_op.hpp b/include/async_mqtt5/impl/unsubscribe_op.hpp index 40f5755..573e2a9 100644 --- a/include/async_mqtt5/impl/unsubscribe_op.hpp +++ b/include/async_mqtt5/impl/unsubscribe_op.hpp @@ -1,18 +1,18 @@ #ifndef ASYNC_MQTT5_UNSUBSCRIBE_OP_HPP #define ASYNC_MQTT5_UNSUBSCRIBE_OP_HPP +#include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include #include +#include +#include namespace async_mqtt5::detail { @@ -144,7 +144,7 @@ private: void on_malformed_packet( const std::string& reason ) { - auto props = disconnect_props{}; + auto props = disconnect_props {}; props[prop::reason_string] = reason; async_disconnect( disconnect_rc_e::malformed_packet, props, false, _svc_ptr, diff --git a/include/async_mqtt5/impl/write_op.hpp b/include/async_mqtt5/impl/write_op.hpp index 2bdd5bf..e14366e 100644 --- a/include/async_mqtt5/impl/write_op.hpp +++ b/include/async_mqtt5/impl/write_op.hpp @@ -1,11 +1,10 @@ #ifndef ASYNC_MQTT5_WRITE_OP_HPP #define ASYNC_MQTT5_WRITE_OP_HPP +#include #include #include -#include -#include #include namespace async_mqtt5::detail { diff --git a/include/async_mqtt5/mqtt_client.hpp b/include/async_mqtt5/mqtt_client.hpp index 132b4ed..9be13fa 100644 --- a/include/async_mqtt5/mqtt_client.hpp +++ b/include/async_mqtt5/mqtt_client.hpp @@ -1,9 +1,14 @@ #ifndef ASYNC_MQTT5_MQTT_CLIENT_HPP #define ASYNC_MQTT5_MQTT_CLIENT_HPP +#include + +#include +#include + #include -#include #include +#include #include #include diff --git a/include/async_mqtt5/types.hpp b/include/async_mqtt5/types.hpp index bc6ed1c..cc3441c 100644 --- a/include/async_mqtt5/types.hpp +++ b/include/async_mqtt5/types.hpp @@ -3,11 +3,11 @@ #include #include + #include -#include #include - +#include namespace async_mqtt5 { diff --git a/test/unit/include/test_common/delayed_op.hpp b/test/unit/include/test_common/delayed_op.hpp index 3819021..cbe46e5 100644 --- a/test/unit/include/test_common/delayed_op.hpp +++ b/test/unit/include/test_common/delayed_op.hpp @@ -4,9 +4,8 @@ #include #include -#include -#include #include +#include #include #include #include diff --git a/test/unit/include/test_common/message_exchange.hpp b/test/unit/include/test_common/message_exchange.hpp index 248d20f..375bdf2 100644 --- a/test/unit/include/test_common/message_exchange.hpp +++ b/test/unit/include/test_common/message_exchange.hpp @@ -7,16 +7,10 @@ #include #include -#include -#include -#include - #include "test_common/delayed_op.hpp" namespace async_mqtt5::test { -namespace asio = boost::asio; - using error_code = boost::system::error_code; using time_stamp = std::chrono::time_point; using duration = time_stamp::duration; diff --git a/test/unit/include/test_common/packet_util.hpp b/test/unit/include/test_common/packet_util.hpp index a086063..9eff6cd 100644 --- a/test/unit/include/test_common/packet_util.hpp +++ b/test/unit/include/test_common/packet_util.hpp @@ -1,15 +1,16 @@ #ifndef ASYNC_MQTT5_TEST_PACKET_UTIL_HPP #define ASYNC_MQTT5_TEST_PACKET_UTIL_HPP -#include #include +#include + #include #include -#include namespace async_mqtt5::test { +using error_code = boost::system::error_code; inline qos_e extract_qos(uint8_t flags) { auto byte = (flags & 0b0110) >> 1; diff --git a/test/unit/include/test_common/test_broker.hpp b/test/unit/include/test_common/test_broker.hpp index 2422e88..cf50f0f 100644 --- a/test/unit/include/test_common/test_broker.hpp +++ b/test/unit/include/test_common/test_broker.hpp @@ -9,18 +9,18 @@ #include #include #include -#include -#include #include #include +#include + #include #include -#include "test_common/protocol_logging.hpp" #include "test_common/message_exchange.hpp" #include "test_common/packet_util.hpp" +#include "test_common/protocol_logging.hpp" namespace async_mqtt5::test { diff --git a/test/unit/include/test_common/test_service.hpp b/test/unit/include/test_common/test_service.hpp index ec697c8..a8ec9ce 100644 --- a/test/unit/include/test_common/test_service.hpp +++ b/test/unit/include/test_common/test_service.hpp @@ -1,9 +1,8 @@ #ifndef ASYNC_MQTT5_TEST_TEST_SERVICE_HPP #define ASYNC_MQTT5_TEST_TEST_SERVICE_HPP -#include - #include +#include #include #include @@ -11,6 +10,8 @@ namespace async_mqtt5::test { +namespace asio = boost::asio; + template < typename StreamType, typename TlsContext = std::monostate @@ -31,13 +32,13 @@ public: CompletionToken&& token ) { auto initiation = [this](auto handler) { - auto ex = boost::asio::get_associated_executor(handler, _ex); - boost::asio::post(ex, - boost::asio::prepend(std::move(handler), error_code {}) + auto ex = asio::get_associated_executor(handler, _ex); + asio::post(ex, + asio::prepend(std::move(handler), error_code {}) ); }; - return boost::asio::async_initiate< + return asio::async_initiate< CompletionToken, void (error_code) > (std::move(initiation), token); } diff --git a/test/unit/include/test_common/test_stream.hpp b/test/unit/include/test_common/test_stream.hpp index 4373157..fc352db 100644 --- a/test/unit/include/test_common/test_stream.hpp +++ b/test/unit/include/test_common/test_stream.hpp @@ -3,18 +3,17 @@ #include #include -#include -#include #include +#include +#include + #include -#include #include "test_common/test_broker.hpp" namespace async_mqtt5::test { namespace asio = boost::asio; -namespace asioex = asio::experimental; using error_code = boost::system::error_code; using time_stamp = std::chrono::time_point; diff --git a/test/unit/src/run_tests.cpp b/test/unit/src/run_tests.cpp index 215a4ff..591b261 100644 --- a/test/unit/src/run_tests.cpp +++ b/test/unit/src/run_tests.cpp @@ -1,4 +1,5 @@ #include + #include boost::unit_test::test_suite* init_tests( diff --git a/test/unit/test/client_broker.cpp b/test/unit/test/client_broker.cpp index 53c4d68..4747cb9 100644 --- a/test/unit/test/client_broker.cpp +++ b/test/unit/test/client_broker.cpp @@ -1,15 +1,16 @@ +#include + #include #include #include -#include #include -#include "test_common/test_stream.hpp" -#include "test_common/message_exchange.hpp" +#include -#include +#include "test_common/message_exchange.hpp" +#include "test_common/test_stream.hpp" using namespace async_mqtt5; diff --git a/test/unit/test/coroutine.cpp b/test/unit/test/coroutine.cpp index 2e3a238..e11f3c3 100644 --- a/test/unit/test/coroutine.cpp +++ b/test/unit/test/coroutine.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include #include @@ -10,6 +8,8 @@ #include +#include + BOOST_AUTO_TEST_SUITE(coroutine/*, *boost::unit_test::disabled()*/) using namespace async_mqtt5; diff --git a/test/unit/test/publish_send_op.cpp b/test/unit/test/publish_send_op.cpp index 3c20d15..60efd79 100644 --- a/test/unit/test/publish_send_op.cpp +++ b/test/unit/test/publish_send_op.cpp @@ -6,6 +6,7 @@ #include #include + #include #include diff --git a/test/unit/test/serialization.cpp b/test/unit/test/serialization.cpp index 7ed7d1e..b875065 100644 --- a/test/unit/test/serialization.cpp +++ b/test/unit/test/serialization.cpp @@ -1,6 +1,7 @@ #include #include + #include #include diff --git a/win/mqtt-client.vcxproj b/win/mqtt-client.vcxproj index d010973..774cc12 100644 --- a/win/mqtt-client.vcxproj +++ b/win/mqtt-client.vcxproj @@ -55,9 +55,9 @@ + - diff --git a/win/mqtt-client.vcxproj.filters b/win/mqtt-client.vcxproj.filters index 1766729..ea26241 100644 --- a/win/mqtt-client.vcxproj.filters +++ b/win/mqtt-client.vcxproj.filters @@ -147,12 +147,12 @@ Header Files\include - - Header Files\include - Header Files + + Header Files\include + diff --git a/win/test/mqtt-test.vcxproj b/win/test/mqtt-test.vcxproj index b4dcce6..9080c95 100644 --- a/win/test/mqtt-test.vcxproj +++ b/win/test/mqtt-test.vcxproj @@ -18,13 +18,6 @@ x64 - - - - - - - @@ -34,6 +27,13 @@ + + + + + + + 16.0 Win32Proj diff --git a/win/test/mqtt-test.vcxproj.filters b/win/test/mqtt-test.vcxproj.filters index a09cc39..e70f94c 100644 --- a/win/test/mqtt-test.vcxproj.filters +++ b/win/test/mqtt-test.vcxproj.filters @@ -13,29 +13,12 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - {237ad32b-00b2-42f0-8b54-e4f62a437742} - {6361a7f6-7954-4ea3-a2a7-f3b15537a3ac} - - - - Source Files\test - - - Source Files\test - - - Source Files\test - - - Source Files\test - - - Source Files - + + {cf0bb550-9227-400c-9e0a-8b38fe2c32a3} + @@ -60,4 +43,21 @@ Header Files\test_common + + + Source Files\test + + + Source Files\test + + + Source Files\test + + + Source Files\test + + + Source Files + + \ No newline at end of file