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