void Connection::handleWriteResponse(ReplyPtr reply) { LOG_DEBUG(socket().native() << ": handleWriteResponse() " << haveResponse_ << " " << responseDone_); if (haveResponse_) startWriteResponse(reply); else { if (!responseDone_) { /* * Keep reply open and wait for more data. */ } else { reply->logReply(request_handler_.logger()); if (reply->closeConnection()) ConnectionManager_.stop(shared_from_this()); else { request_parser_.reset(); request_.reset(); responseDone_ = false; while (rcv_buffers_.size() > 1) rcv_buffers_.pop_front(); if (rcv_remaining_ < rcv_buffers_.back().data() + rcv_buffer_size_) handleReadRequest0(); else startAsyncReadRequest(rcv_buffers_.back(), KEEPALIVE_TIMEOUT); } } } }
void Connection::handleReadRequest(const asio_error_code& e, std::size_t bytes_transferred) { LOG_DEBUG(socket().native() << ": handleReadRequest(): " << e.message()); cancelReadTimer(); if (!e) { remaining_ = buffer_.data(); buffer_size_ = bytes_transferred; handleReadRequest0(); } else if (e != asio::error::operation_aborted && e != asio::error::bad_descriptor) { handleError(e); } }