Commit e47b5f40 authored by Jakob Otto's avatar Jakob Otto

Include review feedback

parent 0e815a1a
......@@ -79,14 +79,12 @@ public:
}
bool handle_read_event(endpoint_manager&) override {
size_t reads = 0;
while (reads++ < this->max_consecutive_reads_) {
CAF_LOG_TRACE(CAF_ARG(this->handle_.id));
CAF_LOG_TRACE(CAF_ARG(this->handle_.id));
for (size_t reads = 0; reads < this->max_consecutive_reads_; ++reads) {
auto ret = read(this->handle_, this->read_buf_);
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");
auto ep = res->second;
this->read_buf_.resize(num_bytes);
this->next_layer_.handle_data(*this, this->read_buf_, std::move(ep));
prepare_next_read();
......
......@@ -73,12 +73,11 @@ public:
// -- member functions -------------------------------------------------------
bool handle_read_event(endpoint_manager&) override {
size_t reads = 0;
while (reads++ < this->max_consecutive_reads_) {
CAF_LOG_TRACE(CAF_ARG2("handle", this->handle().id));
for (size_t reads = 0; reads < this->max_consecutive_reads_; ++reads) {
auto buf = this->read_buf_.data() + this->collected_;
size_t len = this->read_threshold_ - this->collected_;
CAF_LOG_TRACE(CAF_ARG2("handle", this->handle().id)
<< CAF_ARG2("missing", len));
CAF_LOG_DEBUG(CAF_ARG2("missing", len));
auto ret = read(this->handle_, make_span(buf, len));
// Update state.
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