@@ -99,6 +99,7 @@ class request {
99
99
{
100
100
payload_.clear ();
101
101
commands_ = 0 ;
102
+ has_hello_priority_ = false ;
102
103
}
103
104
104
105
// / Calls std::string::reserve on the internal storage.
@@ -139,14 +140,12 @@ class request {
139
140
template <class ... Ts>
140
141
void push (std::string_view cmd, Ts const &... args)
141
142
{
142
- auto const size_before = std::size (payload_);
143
143
auto constexpr pack_size = sizeof ...(Ts);
144
144
resp3::add_header (payload_, resp3::type::array, 1 + pack_size);
145
145
resp3::add_bulk (payload_, cmd);
146
146
resp3::add_bulk (payload_, std::tie (std::forward<Ts const &>(args)...));
147
- auto const size_after = std::size (payload_);
148
147
149
- check_cmd (cmd, size_after - size_before );
148
+ check_cmd (cmd);
150
149
}
151
150
152
151
/* * @brief Appends a new command to the end of the request.
@@ -194,7 +193,6 @@ class request {
194
193
if (begin == end)
195
194
return ;
196
195
197
- auto const size_before = std::size (payload_);
198
196
auto constexpr size = resp3::bulk_counter<value_type>::size;
199
197
auto const distance = std::distance (begin, end);
200
198
resp3::add_header (payload_, resp3::type::array, 2 + size * distance);
@@ -204,9 +202,7 @@ class request {
204
202
for (; begin != end; ++begin)
205
203
resp3::add_bulk (payload_, *begin);
206
204
207
- auto const size_after = std::size (payload_);
208
-
209
- check_cmd (cmd, size_after - size_before);
205
+ check_cmd (cmd);
210
206
}
211
207
212
208
/* * @brief Appends a new command to the end of the request.
@@ -249,7 +245,6 @@ class request {
249
245
if (begin == end)
250
246
return ;
251
247
252
- auto const size_before = std::size (payload_);
253
248
auto constexpr size = resp3::bulk_counter<value_type>::size;
254
249
auto const distance = std::distance (begin, end);
255
250
resp3::add_header (payload_, resp3::type::array, 1 + size * distance);
@@ -258,9 +253,7 @@ class request {
258
253
for (; begin != end; ++begin)
259
254
resp3::add_bulk (payload_, *begin);
260
255
261
- auto const size_after = std::size (payload_);
262
-
263
- check_cmd (cmd, size_after - size_before);
256
+ check_cmd (cmd);
264
257
}
265
258
266
259
/* * @brief Appends a new command to the end of the request.
@@ -308,18 +301,13 @@ class request {
308
301
}
309
302
310
303
private:
311
- void check_cmd (std::string_view cmd, std:: size_t n )
304
+ void check_cmd (std::string_view cmd)
312
305
{
313
306
if (!detail::has_response (cmd))
314
307
++commands_;
315
308
316
- if (cmd == " HELLO" ) {
309
+ if (cmd == " HELLO" )
317
310
has_hello_priority_ = cfg_.hello_with_priority ;
318
- if (has_hello_priority_) {
319
- auto const shift = std::size (payload_) - n;
320
- std::rotate (std::begin (payload_), std::begin (payload_) + shift, std::end (payload_));
321
- }
322
- }
323
311
}
324
312
325
313
config cfg_;
0 commit comments