From 242a0571e03b53e80fd6e3999e79cce079cd36fd Mon Sep 17 00:00:00 2001 From: "Timur A. Fatkhullin" Date: Fri, 27 Sep 2024 14:57:46 +0300 Subject: [PATCH] ... --- net/adc_net_concepts.h | 14 ++++++++++++++ net/adc_netserver.h | 26 ++------------------------ net/asio/adc_netservice_asio.h | 1 + 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/net/adc_net_concepts.h b/net/adc_net_concepts.h index 2028856..0c9a8f7 100644 --- a/net/adc_net_concepts.h +++ b/net/adc_net_concepts.h @@ -47,6 +47,20 @@ using adc_common_duration_t = adc_duration_common_type_t; +// concepts for asynchronous opereration callback callable first argument type (asynchronous operation error) +// 1) the type must be convertible to boolean and +// a) true - asynchronous operation completed without errors +// b) false - an error occured +template +concept adc_async_callback_err_t = std::convertible_to, bool>; + +// concepts for asynchronous opereration callback callable +// 1) the type must be a callable with at least 1 input argument +// 2) the first argument type must satisfy the concept adc_async_callback_err_t +template +concept adc_async_callback_t = traits::adc_is_callable && traits::adc_func_traits::arity && + adc_async_callback_err_t>; + /* struct NetService { typedef ImplementationDependentT netservice_ident_t; diff --git a/net/adc_netserver.h b/net/adc_netserver.h index f335bd8..67e3a22 100644 --- a/net/adc_netserver.h +++ b/net/adc_netserver.h @@ -130,32 +130,10 @@ protected: } } - virtual void daemonizePrepare() - { - // - _impl.daemonizePrepare(); - }; + virtual void daemonizePrepare() = 0; - virtual void daemonizeFinalize() - { - // - _impl.daemonizeFinalize(); - }; + virtual void daemonizeFinalize() = 0; }; -namespace traits -{ - -// network server concept -template -concept adc_netserver_c = requires { - typename T::server_impl_t; - std::derived_from>; -}; - -} // namespace traits - - - } // namespace adc diff --git a/net/asio/adc_netservice_asio.h b/net/asio/adc_netservice_asio.h index 7a97a67..89a102f 100644 --- a/net/asio/adc_netservice_asio.h +++ b/net/asio/adc_netservice_asio.h @@ -380,6 +380,7 @@ public: if (start) { start = false; if (_receiveQueue.size()) { // return message from queue + timer->cancel(); msg = _receiveQueue.front(); _receiveQueue.pop(); if constexpr (std::is_same_v) {