Commit e47b5f40 authored by Jakob Otto's avatar Jakob Otto

Include review feedback

parent 0e815a1a
...@@ -79,14 +79,12 @@ public: ...@@ -79,14 +79,12 @@ public:
} }
bool handle_read_event(endpoint_manager&) override { bool handle_read_event(endpoint_manager&) override {
size_t reads = 0; CAF_LOG_TRACE(CAF_ARG(this->handle_.id));
while (reads++ < this->max_consecutive_reads_) { for (size_t reads = 0; reads < this->max_consecutive_reads_; ++reads) {
CAF_LOG_TRACE(CAF_ARG(this->handle_.id));
auto ret = read(this->handle_, this->read_buf_); auto ret = read(this->handle_, this->read_buf_);
if (auto res = get_if<std::pair<size_t, ip_endpoint>>(&ret)) { if (auto res = get_if<std::pair<size_t, ip_endpoint>>(&ret)) {
auto num_bytes = res->first; auto& [num_bytes, ep] = *res;
CAF_LOG_DEBUG("received " << num_bytes << " bytes"); CAF_LOG_DEBUG("received " << num_bytes << " bytes");
auto ep = res->second;
this->read_buf_.resize(num_bytes); this->read_buf_.resize(num_bytes);
this->next_layer_.handle_data(*this, this->read_buf_, std::move(ep)); this->next_layer_.handle_data(*this, this->read_buf_, std::move(ep));
prepare_next_read(); prepare_next_read();
......
...@@ -73,12 +73,11 @@ public: ...@@ -73,12 +73,11 @@ public:
// -- member functions ------------------------------------------------------- // -- member functions -------------------------------------------------------
bool handle_read_event(endpoint_manager&) override { bool handle_read_event(endpoint_manager&) override {
size_t reads = 0; CAF_LOG_TRACE(CAF_ARG2("handle", this->handle().id));
while (reads++ < this->max_consecutive_reads_) { for (size_t reads = 0; reads < this->max_consecutive_reads_; ++reads) {
auto buf = this->read_buf_.data() + this->collected_; auto buf = this->read_buf_.data() + this->collected_;
size_t len = this->read_threshold_ - this->collected_; size_t len = this->read_threshold_ - this->collected_;
CAF_LOG_TRACE(CAF_ARG2("handle", this->handle().id) CAF_LOG_DEBUG(CAF_ARG2("missing", len));
<< CAF_ARG2("missing", len));
auto ret = read(this->handle_, make_span(buf, len)); auto ret = read(this->handle_, make_span(buf, len));
// Update state. // Update state.
if (auto num_bytes = get_if<size_t>(&ret)) { if (auto num_bytes = get_if<size_t>(&ret)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment