refactor
This commit is contained in:
parent
f5668c82a7
commit
bf66bff7b4
@ -52,23 +52,23 @@ public:
|
||||
~packet() = default;
|
||||
|
||||
private:
|
||||
data_buffer buffer_;
|
||||
std::size_t decode_offset_ = 0U;
|
||||
data_buffer buffer_{};
|
||||
std::size_t decode_offset_{0U};
|
||||
|
||||
public:
|
||||
[[nodiscard]] static auto decode_json(packet &response,
|
||||
json &json_data) -> int;
|
||||
[[nodiscard]] static auto decode_json(packet &response, json &json_data)
|
||||
-> int;
|
||||
|
||||
public:
|
||||
void clear();
|
||||
|
||||
[[nodiscard]] auto current_pointer() -> unsigned char * {
|
||||
return (decode_offset_ < buffer_.size()) ? &buffer_[decode_offset_]
|
||||
return (decode_offset_ < buffer_.size()) ? &buffer_.at(decode_offset_)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto current_pointer() const -> const unsigned char * {
|
||||
return (decode_offset_ < buffer_.size()) ? &buffer_[decode_offset_]
|
||||
return (decode_offset_ < buffer_.size()) ? &buffer_.at(decode_offset_)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@ public:
|
||||
|
||||
private:
|
||||
struct connection {
|
||||
connection(io_context &context, tcp::acceptor &acceptor_)
|
||||
: socket(context), acceptor(acceptor_) {}
|
||||
connection(io_context &ctx, tcp::acceptor &acceptor_)
|
||||
: socket(ctx), acceptor(acceptor_) {}
|
||||
|
||||
tcp::socket socket;
|
||||
tcp::acceptor &acceptor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user