From d12041edb02ceeeed308691a4ebc69b600142c8b Mon Sep 17 00:00:00 2001 From: Marcelo Zimbres Date: Sun, 13 Oct 2024 21:14:19 +0200 Subject: [PATCH 1/4] Updates the copyright notice. --- example/sync_connection.hpp | 2 +- include/boost/redis.hpp | 2 +- include/boost/redis/adapter/adapt.hpp | 2 +- include/boost/redis/adapter/detail/adapters.hpp | 2 +- include/boost/redis/adapter/detail/response_traits.hpp | 2 +- include/boost/redis/adapter/detail/result_traits.hpp | 2 +- include/boost/redis/adapter/ignore.hpp | 2 +- include/boost/redis/adapter/result.hpp | 2 +- include/boost/redis/config.hpp | 2 +- include/boost/redis/connection.hpp | 2 +- include/boost/redis/detail/connector.hpp | 2 +- include/boost/redis/detail/handshaker.hpp | 2 +- include/boost/redis/detail/health_checker.hpp | 2 +- include/boost/redis/detail/helper.hpp | 2 +- include/boost/redis/detail/resolver.hpp | 2 +- include/boost/redis/detail/write.hpp | 2 +- include/boost/redis/error.hpp | 2 +- include/boost/redis/ignore.hpp | 2 +- include/boost/redis/impl/connection.ipp | 2 +- include/boost/redis/impl/error.ipp | 2 +- include/boost/redis/impl/ignore.ipp | 2 +- include/boost/redis/impl/logger.ipp | 2 +- include/boost/redis/impl/request.ipp | 2 +- include/boost/redis/impl/response.ipp | 2 +- include/boost/redis/logger.hpp | 2 +- include/boost/redis/operation.hpp | 2 +- include/boost/redis/request.hpp | 2 +- include/boost/redis/resp3/impl/serialization.ipp | 2 +- include/boost/redis/resp3/impl/type.ipp | 2 +- include/boost/redis/resp3/node.hpp | 2 +- include/boost/redis/resp3/serialization.hpp | 2 +- include/boost/redis/resp3/type.hpp | 2 +- include/boost/redis/response.hpp | 2 +- include/boost/redis/src.hpp | 2 +- include/boost/redis/usage.hpp | 2 +- 35 files changed, 35 insertions(+), 35 deletions(-) diff --git a/example/sync_connection.hpp b/example/sync_connection.hpp index a27ee735..c568ca98 100644 --- a/example/sync_connection.hpp +++ b/example/sync_connection.hpp @@ -1,5 +1,5 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis.hpp b/include/boost/redis.hpp index c72b1f72..4017bf52 100644 --- a/include/boost/redis.hpp +++ b/include/boost/redis.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/adapter/adapt.hpp b/include/boost/redis/adapter/adapt.hpp index f2582af1..7cd625f0 100644 --- a/include/boost/redis/adapter/adapt.hpp +++ b/include/boost/redis/adapter/adapt.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/adapter/detail/adapters.hpp b/include/boost/redis/adapter/detail/adapters.hpp index d82d5fd0..5d731498 100644 --- a/include/boost/redis/adapter/detail/adapters.hpp +++ b/include/boost/redis/adapter/detail/adapters.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/adapter/detail/response_traits.hpp b/include/boost/redis/adapter/detail/response_traits.hpp index 0598010a..67b0a5ca 100644 --- a/include/boost/redis/adapter/detail/response_traits.hpp +++ b/include/boost/redis/adapter/detail/response_traits.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/adapter/detail/result_traits.hpp b/include/boost/redis/adapter/detail/result_traits.hpp index e1193d89..79dc235f 100644 --- a/include/boost/redis/adapter/detail/result_traits.hpp +++ b/include/boost/redis/adapter/detail/result_traits.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/adapter/ignore.hpp b/include/boost/redis/adapter/ignore.hpp index 7a4b8fc1..94938d64 100644 --- a/include/boost/redis/adapter/ignore.hpp +++ b/include/boost/redis/adapter/ignore.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/adapter/result.hpp b/include/boost/redis/adapter/result.hpp index 3e1bcccc..b1af7b65 100644 --- a/include/boost/redis/adapter/result.hpp +++ b/include/boost/redis/adapter/result.hpp @@ -1,5 +1,5 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/config.hpp b/include/boost/redis/config.hpp index caadd80d..297918c4 100644 --- a/include/boost/redis/config.hpp +++ b/include/boost/redis/config.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/connection.hpp b/include/boost/redis/connection.hpp index 71348f33..03a6d8ef 100644 --- a/include/boost/redis/connection.hpp +++ b/include/boost/redis/connection.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/detail/connector.hpp b/include/boost/redis/detail/connector.hpp index fc74b089..bd516137 100644 --- a/include/boost/redis/detail/connector.hpp +++ b/include/boost/redis/detail/connector.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/detail/handshaker.hpp b/include/boost/redis/detail/handshaker.hpp index 37fe7732..0338d3cc 100644 --- a/include/boost/redis/detail/handshaker.hpp +++ b/include/boost/redis/detail/handshaker.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/detail/health_checker.hpp b/include/boost/redis/detail/health_checker.hpp index 6d62a1d4..b1b77c62 100644 --- a/include/boost/redis/detail/health_checker.hpp +++ b/include/boost/redis/detail/health_checker.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/detail/helper.hpp b/include/boost/redis/detail/helper.hpp index da20ac23..2a58bdc5 100644 --- a/include/boost/redis/detail/helper.hpp +++ b/include/boost/redis/detail/helper.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/detail/resolver.hpp b/include/boost/redis/detail/resolver.hpp index ceb611fe..583f7c3a 100644 --- a/include/boost/redis/detail/resolver.hpp +++ b/include/boost/redis/detail/resolver.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/detail/write.hpp b/include/boost/redis/detail/write.hpp index c33c97ab..a6cb0639 100644 --- a/include/boost/redis/detail/write.hpp +++ b/include/boost/redis/detail/write.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/error.hpp b/include/boost/redis/error.hpp index 0519b7fb..82ebce46 100644 --- a/include/boost/redis/error.hpp +++ b/include/boost/redis/error.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/ignore.hpp b/include/boost/redis/ignore.hpp index 28817ae9..bdaae05c 100644 --- a/include/boost/redis/ignore.hpp +++ b/include/boost/redis/ignore.hpp @@ -1,5 +1,5 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/impl/connection.ipp b/include/boost/redis/impl/connection.ipp index 12abc996..4a5a484b 100644 --- a/include/boost/redis/impl/connection.ipp +++ b/include/boost/redis/impl/connection.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/impl/error.ipp b/include/boost/redis/impl/error.ipp index f7b7fa2b..030c129f 100644 --- a/include/boost/redis/impl/error.ipp +++ b/include/boost/redis/impl/error.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/impl/ignore.ipp b/include/boost/redis/impl/ignore.ipp index d58d05df..05c46214 100644 --- a/include/boost/redis/impl/ignore.ipp +++ b/include/boost/redis/impl/ignore.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/impl/logger.ipp b/include/boost/redis/impl/logger.ipp index 4008e097..4926d9b8 100644 --- a/include/boost/redis/impl/logger.ipp +++ b/include/boost/redis/impl/logger.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/impl/request.ipp b/include/boost/redis/impl/request.ipp index 293a39cf..d2c29f08 100644 --- a/include/boost/redis/impl/request.ipp +++ b/include/boost/redis/impl/request.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/impl/response.ipp b/include/boost/redis/impl/response.ipp index 88eddadb..e2d687d8 100644 --- a/include/boost/redis/impl/response.ipp +++ b/include/boost/redis/impl/response.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/logger.hpp b/include/boost/redis/logger.hpp index 4b983175..5b8c59fd 100644 --- a/include/boost/redis/logger.hpp +++ b/include/boost/redis/logger.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/operation.hpp b/include/boost/redis/operation.hpp index bde486a6..233d1239 100644 --- a/include/boost/redis/operation.hpp +++ b/include/boost/redis/operation.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/request.hpp b/include/boost/redis/request.hpp index 0e62e0a9..2dcbf529 100644 --- a/include/boost/redis/request.hpp +++ b/include/boost/redis/request.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/resp3/impl/serialization.ipp b/include/boost/redis/resp3/impl/serialization.ipp index 5fc1d67e..16ad124a 100644 --- a/include/boost/redis/resp3/impl/serialization.ipp +++ b/include/boost/redis/resp3/impl/serialization.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/resp3/impl/type.ipp b/include/boost/redis/resp3/impl/type.ipp index 4fe576cf..bfe33abc 100644 --- a/include/boost/redis/resp3/impl/type.ipp +++ b/include/boost/redis/resp3/impl/type.ipp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/resp3/node.hpp b/include/boost/redis/resp3/node.hpp index 4f2ddfe8..f9761813 100644 --- a/include/boost/redis/resp3/node.hpp +++ b/include/boost/redis/resp3/node.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/resp3/serialization.hpp b/include/boost/redis/resp3/serialization.hpp index f8c14da1..0a0dc47f 100644 --- a/include/boost/redis/resp3/serialization.hpp +++ b/include/boost/redis/resp3/serialization.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/resp3/type.hpp b/include/boost/redis/resp3/type.hpp index fd247848..9f3e9015 100644 --- a/include/boost/redis/resp3/type.hpp +++ b/include/boost/redis/resp3/type.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/response.hpp b/include/boost/redis/response.hpp index ac296741..5af97a09 100644 --- a/include/boost/redis/response.hpp +++ b/include/boost/redis/response.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/src.hpp b/include/boost/redis/src.hpp index f749e3f3..2d5cac76 100644 --- a/include/boost/redis/src.hpp +++ b/include/boost/redis/src.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) diff --git a/include/boost/redis/usage.hpp b/include/boost/redis/usage.hpp index 9a262620..f80e19d1 100644 --- a/include/boost/redis/usage.hpp +++ b/include/boost/redis/usage.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) From 6ce8e40ddc6f31cd4d6287e2ed034dbec6af83c5 Mon Sep 17 00:00:00 2001 From: Marcelo Zimbres Date: Sat, 12 Oct 2024 22:15:06 +0200 Subject: [PATCH 2/4] Disentangles resolve and connect from run operations. --- .../boost/redis/detail/connection_base.hpp | 4 +- include/boost/redis/detail/runner.hpp | 104 ++++++++---------- include/boost/redis/impl/logger.ipp | 14 +-- include/boost/redis/logger.hpp | 10 +- test/test_conn_push.cpp | 2 +- 5 files changed, 62 insertions(+), 72 deletions(-) diff --git a/include/boost/redis/detail/connection_base.hpp b/include/boost/redis/detail/connection_base.hpp index e72c1f16..116d8ec8 100644 --- a/include/boost/redis/detail/connection_base.hpp +++ b/include/boost/redis/detail/connection_base.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) @@ -705,7 +705,7 @@ class connection_base { template friend struct writer_op; template friend struct run_op; template friend struct exec_op; - template friend struct run_all_op; + template friend struct runner_op; void cancel_push_requests() { diff --git a/include/boost/redis/detail/runner.hpp b/include/boost/redis/detail/runner.hpp index de185e71..90e51f44 100644 --- a/include/boost/redis/detail/runner.hpp +++ b/include/boost/redis/detail/runner.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2018-2023 Marcelo Zimbres Silva (mzimbres@gmail.com) +/* Copyright (c) 2018-2024 Marcelo Zimbres Silva (mzimbres@gmail.com) * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE.txt) @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -87,11 +88,52 @@ class runner_op { { BOOST_ASIO_CORO_REENTER (coro_) { + BOOST_ASIO_CORO_YIELD + runner_->resv_.async_resolve( + asio::prepend(std::move(self), std::array {})); + + logger_.on_resolve(ec0, runner_->resv_.results()); + + if (ec0 || redis::detail::is_cancelled(self)) { + self.complete(!!ec0 ? ec0 : asio::error::operation_aborted); + return; + } + + BOOST_ASIO_CORO_YIELD + runner_->ctor_.async_connect( + conn_->next_layer().next_layer(), + runner_->resv_.results(), + asio::prepend(std::move(self), std::array {})); + + logger_.on_connect(ec0, runner_->ctor_.endpoint()); + + if (ec0 || redis::detail::is_cancelled(self)) { + self.complete(!!ec0 ? ec0 : asio::error::operation_aborted); + return; + } + + if (conn_->use_ssl()) { + BOOST_ASIO_CORO_YIELD + runner_->hsher_.async_handshake( + conn_->next_layer(), + asio::prepend(std::move(self), + std::array {})); + + logger_.on_ssl_handshake(ec0); + if (ec0 || redis::detail::is_cancelled(self)) { + self.complete(!!ec0 ? ec0 : asio::error::operation_aborted); + return; + } + } + + // Note: Oder is important here because async_run might + // trigger an async_write before the async_hello thereby + // causing authentication problems. BOOST_ASIO_CORO_YIELD asio::experimental::make_parallel_group( - [this](auto token) { return runner_->async_run_all(*conn_, logger_, token); }, + [this](auto token) { return runner_->async_hello(*conn_, logger_, token); }, [this](auto token) { return runner_->health_checker_.async_check_health(*conn_, logger_, token); }, - [this](auto token) { return runner_->async_hello(*conn_, logger_, token); } + [this](auto token) { return conn_->async_run_lean(runner_->cfg_, logger_, token); } ).async_wait( asio::experimental::wait_for_one_error(), std::move(self)); @@ -103,59 +145,17 @@ class runner_op { return; } - if (ec0 == error::connect_timeout || ec0 == error::resolve_timeout) { + if (order[0] == 0 && !!ec0) { self.complete(ec0); return; } - if (order[0] == 2 && !!ec2) { - self.complete(ec2); - return; - } - if (order[0] == 1 && ec1 == error::pong_timeout) { self.complete(ec1); return; } - self.complete(ec0); - } - } -}; - -template -struct run_all_op { - Runner* runner_ = nullptr; - Connection* conn_ = nullptr; - Logger logger_; - asio::coroutine coro_{}; - - template - void operator()(Self& self, system::error_code ec = {}, std::size_t = 0) - { - BOOST_ASIO_CORO_REENTER (coro_) - { - BOOST_ASIO_CORO_YIELD - runner_->resv_.async_resolve(std::move(self)); - logger_.on_resolve(ec, runner_->resv_.results()); - BOOST_REDIS_CHECK_OP0(conn_->cancel(operation::run);) - - BOOST_ASIO_CORO_YIELD - runner_->ctor_.async_connect(conn_->next_layer().next_layer(), runner_->resv_.results(), std::move(self)); - logger_.on_connect(ec, runner_->ctor_.endpoint()); - BOOST_REDIS_CHECK_OP0(conn_->cancel(operation::run);) - - if (conn_->use_ssl()) { - BOOST_ASIO_CORO_YIELD - runner_->hsher_.async_handshake(conn_->next_layer(), std::move(self)); - logger_.on_ssl_handshake(ec); - BOOST_REDIS_CHECK_OP0(conn_->cancel(operation::run);) - } - - BOOST_ASIO_CORO_YIELD - conn_->async_run_lean(runner_->cfg_, logger_, std::move(self)); - BOOST_REDIS_CHECK_OP0(;) - self.complete(ec); + self.complete(ec2); } } }; @@ -207,19 +207,9 @@ class runner { using health_checker_type = health_checker; using timer_type = typename connector_type::timer_type; - template friend struct run_all_op; template friend class runner_op; template friend struct hello_op; - template - auto async_run_all(Connection& conn, Logger l, CompletionToken token) - { - return asio::async_compose - < CompletionToken - , void(system::error_code) - >(run_all_op{this, &conn, l}, token, conn); - } - template auto async_hello(Connection& conn, Logger l, CompletionToken token) { diff --git a/include/boost/redis/impl/logger.ipp b/include/boost/redis/impl/logger.ipp index 4926d9b8..0b8624c5 100644 --- a/include/boost/redis/impl/logger.ipp +++ b/include/boost/redis/impl/logger.ipp @@ -156,19 +156,19 @@ logger::on_hello( void logger::on_runner( - system::error_code const& run_all_ec, - system::error_code const& health_check_ec, - system::error_code const& hello_ec) + system::error_code const& hello, + system::error_code const& check_health, + system::error_code const& run) { if (level_ < level::info) return; write_prefix(); - std::clog << "runner-op: " - << run_all_ec.message() << " (async_run_all), " - << health_check_ec.message() << " (async_health_check) " - << hello_ec.message() << " (async_hello)."; + std::clog << "hello: " + << hello.message() << " (async_hello), " + << check_health.message() << " (async_check_health) " + << run.message() << " (async_run_lean)."; std::clog << std::endl; } diff --git a/include/boost/redis/logger.hpp b/include/boost/redis/logger.hpp index 5b8c59fd..152e7ed0 100644 --- a/include/boost/redis/logger.hpp +++ b/include/boost/redis/logger.hpp @@ -143,15 +143,15 @@ class logger { /** @brief Called when the runner operation completes. * @ingroup high-level-api * - * @param run_all_ec Error code returned by the run_all operation. - * @param health_check_ec Error code returned by the health checker operation. * @param hello_ec Error code returned by the health checker operation. + * @param health_check_ec Error code returned by the health checker operation. + * @param run_all_ec Error code returned by the run_all operation. */ void on_runner( - system::error_code const& run_all_ec, - system::error_code const& health_check_ec, - system::error_code const& hello_ec); + system::error_code const& hello, + system::error_code const& health_check, + system::error_code const& run); void on_check_health( diff --git a/test/test_conn_push.cpp b/test/test_conn_push.cpp index f7c5bc0b..ff2a9356 100644 --- a/test/test_conn_push.cpp +++ b/test/test_conn_push.cpp @@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(test_push_adapter) auto cfg = make_test_config(); conn->async_run(cfg, {}, [](auto ec){ - BOOST_CHECK_EQUAL(ec, boost::redis::error::incompatible_size); + BOOST_CHECK_EQUAL(ec, redis::error::incompatible_size); }); ioc.run(); From 3df92b0eace845246a3062c5a6443b568afaa9fd Mon Sep 17 00:00:00 2001 From: Marcelo Zimbres Date: Sun, 13 Oct 2024 21:52:23 +0200 Subject: [PATCH 3/4] Simplifies resolve timeout operation. --- include/boost/redis/detail/resolver.hpp | 66 +++++-------------------- 1 file changed, 13 insertions(+), 53 deletions(-) diff --git a/include/boost/redis/detail/resolver.hpp b/include/boost/redis/detail/resolver.hpp index 583f7c3a..3af89fdf 100644 --- a/include/boost/redis/detail/resolver.hpp +++ b/include/boost/redis/detail/resolver.hpp @@ -12,9 +12,8 @@ #include #include #include -#include #include -#include +#include #include #include @@ -28,52 +27,21 @@ struct resolve_op { template void operator()( Self& self - , std::array order = {} - , system::error_code ec1 = {} - , asio::ip::tcp::resolver::results_type res = {} - , system::error_code ec2 = {}) + , system::error_code ec = {} + , asio::ip::tcp::resolver::results_type res = {}) { BOOST_ASIO_CORO_REENTER (coro) { - resv_->timer_.expires_after(resv_->timeout_); - BOOST_ASIO_CORO_YIELD - asio::experimental::make_parallel_group( - [this](auto token) - { - return resv_->resv_.async_resolve(resv_->addr_.host, resv_->addr_.port, token); - }, - [this](auto token) { return resv_->timer_.async_wait(token);} - ).async_wait( - asio::experimental::wait_for_one(), - std::move(self)); - - if (is_cancelled(self)) { - self.complete(asio::error::operation_aborted); - return; - } - - switch (order[0]) { - case 0: { - // Resolver completed first. - resv_->results_ = res; - self.complete(ec1); - } break; - - case 1: { - if (ec2) { - // Timer completed first with error, perhaps a - // cancellation going on. - self.complete(ec2); - } else { - // Timer completed first without an error, this is a - // resolve timeout. - self.complete(error::resolve_timeout); - } - } break; - - default: BOOST_ASSERT(false); - } + resv_->resv_.async_resolve( + resv_->addr_.host, + resv_->addr_.port, + asio::cancel_after(resv_->timeout_, std::move(self))); + + resv_->results_ = res; + + // TODO: map operation_canceled into error::resolve_timeout + self.complete(ec); } } }; @@ -81,13 +49,7 @@ struct resolve_op { template class resolver { public: - using timer_type = - asio::basic_waitable_timer< - std::chrono::steady_clock, - asio::wait_traits, - Executor>; - - resolver(Executor ex) : resv_{ex} , timer_{ex} {} + resolver(Executor ex) : resv_{ex} {} template auto async_resolve(CompletionToken&& token) @@ -104,7 +66,6 @@ class resolver { case operation::resolve: case operation::all: resv_.cancel(); - timer_.cancel(); break; default: /* ignore */; } @@ -126,7 +87,6 @@ class resolver { template friend struct resolve_op; resolver_type resv_; - timer_type timer_; address addr_; std::chrono::steady_clock::duration timeout_; asio::ip::tcp::resolver::results_type results_; From 870fd223b4af70b6dc038d10fb943393710454bd Mon Sep 17 00:00:00 2001 From: Marcelo Zimbres Date: Sun, 13 Oct 2024 22:26:41 +0200 Subject: [PATCH 4/4] Simplifies the connect operations. --- include/boost/redis/detail/connector.hpp | 75 ++++-------------------- include/boost/redis/detail/resolver.hpp | 4 +- include/boost/redis/detail/runner.hpp | 7 +-- 3 files changed, 16 insertions(+), 70 deletions(-) diff --git a/include/boost/redis/detail/connector.hpp b/include/boost/redis/detail/connector.hpp index bd516137..9d4d2716 100644 --- a/include/boost/redis/detail/connector.hpp +++ b/include/boost/redis/detail/connector.hpp @@ -12,9 +12,8 @@ #include #include #include -#include #include -#include +#include #include #include @@ -30,65 +29,29 @@ struct connect_op { template void operator()( Self& self - , std::array const& order = {} - , system::error_code const& ec1 = {} - , asio::ip::tcp::endpoint const& ep= {} - , system::error_code const& ec2 = {}) + , system::error_code const& ec = {} + , asio::ip::tcp::endpoint const& ep= {}) { BOOST_ASIO_CORO_REENTER (coro) { - ctor_->timer_.expires_after(ctor_->timeout_); - BOOST_ASIO_CORO_YIELD - asio::experimental::make_parallel_group( - [this](auto token) - { - auto f = [](system::error_code const&, auto const&) { return true; }; - return asio::async_connect(*stream, *res_, f, token); - }, - [this](auto token) { return ctor_->timer_.async_wait(token);} - ).async_wait( - asio::experimental::wait_for_one(), - std::move(self)); - - if (is_cancelled(self)) { - self.complete(asio::error::operation_aborted); - return; - } + asio::async_connect(*stream, *res_, + [](system::error_code const&, auto const&) { return true; }, + asio::cancel_after(ctor_->timeout_, std::move(self))); - switch (order[0]) { - case 0: { - ctor_->endpoint_ = ep; - self.complete(ec1); - } break; - case 1: - { - if (ec2) { - self.complete(ec2); - } else { - self.complete(error::connect_timeout); - } - } break; + ctor_->endpoint_ = ep; - default: BOOST_ASSERT(false); + if (ec == asio::error::operation_aborted) { + ec == error::connect_timeout; } + + self.complete(ec); } } }; -template class connector { public: - using timer_type = - asio::basic_waitable_timer< - std::chrono::steady_clock, - asio::wait_traits, - Executor>; - - connector(Executor ex) - : timer_{ex} - {} - void set_config(config const& cfg) { timeout_ = cfg.connect_timeout; } @@ -102,20 +65,7 @@ class connector { return asio::async_compose < CompletionToken , void(system::error_code) - >(connect_op{this, &stream, &res}, token, timer_); - } - - std::size_t cancel(operation op) - { - switch (op) { - case operation::connect: - case operation::all: - timer_.cancel(); - break; - default: /* ignore */; - } - - return 0; + >(connect_op{this, &stream, &res}, token); } auto const& endpoint() const noexcept { return endpoint_;} @@ -123,7 +73,6 @@ class connector { private: template friend struct connect_op; - timer_type timer_; std::chrono::steady_clock::duration timeout_ = std::chrono::seconds{2}; asio::ip::tcp::endpoint endpoint_; }; diff --git a/include/boost/redis/detail/resolver.hpp b/include/boost/redis/detail/resolver.hpp index 3af89fdf..f5406fdd 100644 --- a/include/boost/redis/detail/resolver.hpp +++ b/include/boost/redis/detail/resolver.hpp @@ -40,7 +40,9 @@ struct resolve_op { resv_->results_ = res; - // TODO: map operation_canceled into error::resolve_timeout + if (ec == asio::error::operation_aborted) { + ec == error::resolve_timeout; + } self.complete(ec); } } diff --git a/include/boost/redis/detail/runner.hpp b/include/boost/redis/detail/runner.hpp index 90e51f44..ba005ace 100644 --- a/include/boost/redis/detail/runner.hpp +++ b/include/boost/redis/detail/runner.hpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -165,7 +164,6 @@ class runner { public: runner(Executor ex, config cfg) : resv_{ex} - , ctor_{ex} , hsher_{ex} , health_checker_{ex} , cfg_{cfg} @@ -174,7 +172,6 @@ class runner { std::size_t cancel(operation op) { resv_.cancel(op); - ctor_.cancel(op); hsher_.cancel(op); health_checker_.cancel(op); return 0U; @@ -202,10 +199,8 @@ class runner { private: using resolver_type = resolver; - using connector_type = connector; using handshaker_type = detail::handshaker; using health_checker_type = health_checker; - using timer_type = typename connector_type::timer_type; template friend class runner_op; template friend struct hello_op; @@ -245,7 +240,7 @@ class runner { } resolver_type resv_; - connector_type ctor_; + connector ctor_; handshaker_type hsher_; health_checker_type health_checker_; request hello_req_;