Skip to content

Commit 1060733

Browse files
authored
Merge pull request #248 from boostorg/refactoring_clean_code
Sans-io multiplexing
2 parents f7b4ec2 + f9d0679 commit 1060733

File tree

12 files changed

+787
-460
lines changed

12 files changed

+787
-460
lines changed

include/boost/redis/adapter/any_adapter.hpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@
1818

1919
namespace boost::redis {
2020

21-
namespace detail {
22-
23-
// Forward decl
24-
template <class Executor>
25-
class basic_connection;
26-
27-
}
28-
2921
/** @brief A type-erased reference to a response.
3022
* @ingroup high-level-api
3123
*
@@ -39,9 +31,9 @@ class basic_connection;
3931
* co_await conn.async_exec(req, any_response(resp));
4032
* ```
4133
*/
42-
class any_adapter
43-
{
44-
using fn_type = std::function<void(std::size_t, resp3::basic_node<std::string_view> const&, system::error_code&)>;
34+
class any_adapter {
35+
public:
36+
using fn_type = std::function<void(std::size_t, resp3::node_view const&, system::error_code&)>;
4537

4638
struct impl_t {
4739
fn_type adapt_fn;
@@ -60,7 +52,6 @@ class any_adapter
6052
template <class Executor>
6153
friend class basic_connection;
6254

63-
public:
6455
/**
6556
* @brief Constructor.
6657
*

include/boost/redis/config.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <string>
1111
#include <chrono>
1212
#include <optional>
13+
#include <limits>
1314

1415
namespace boost::redis
1516
{
@@ -78,6 +79,13 @@ struct config {
7879
* To disable reconnection pass zero as duration.
7980
*/
8081
std::chrono::steady_clock::duration reconnect_wait_interval = std::chrono::seconds{1};
82+
83+
/** @brief Maximum size of a socket read.
84+
*
85+
* Sets a limit on how much data is allowed to be read into the
86+
* read buffer. It can be used to prevent DDOS.
87+
*/
88+
std::size_t max_read_size = (std::numeric_limits<std::size_t>::max)();
8189
};
8290

8391
} // boost::redis

0 commit comments

Comments
 (0)