MCPcopy Create free account
hub / github.com/apache/impala / ReadHandler

Method ReadHandler

be/src/kudu/rpc/connection.cc:649–695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649void Connection::ReadHandler(ev::io &watcher, int revents) {
650 DCHECK(reactor_thread_->IsCurrentThread());
651
652 DVLOG(3) << ToString() << " ReadHandler(revents=" << revents << ")";
653 if (revents & EV_ERROR) {
654 reactor_thread_->DestroyConnection(this, Status::NetworkError(ToString() +
655 ": ReadHandler encountered an error"));
656 return;
657 }
658 last_activity_time_ = reactor_thread_->cur_time();
659
660 faststring extra_buf;
661 while (true) {
662 if (!inbound_) {
663 inbound_.reset(new InboundTransfer());
664 }
665 Status status = inbound_->ReceiveBuffer(socket_.get(), &extra_buf);
666 if (PREDICT_FALSE(!status.ok())) {
667 if (status.posix_code() == ESHUTDOWN) {
668 VLOG(1) << ToString() << " shut down by remote end.";
669 } else {
670 LOG(WARNING) << ToString() << " recv error: " << status.ToString();
671 }
672 reactor_thread_->DestroyConnection(this, status);
673 return;
674 }
675 if (!inbound_->TransferFinished()) {
676 DVLOG(3) << ToString() << ": read is not yet finished yet.";
677 return;
678 }
679 DVLOG(3) << ToString() << ": finished reading " << inbound_->data().size() << " bytes";
680
681 if (direction_ == CLIENT) {
682 HandleCallResponse(std::move(inbound_));
683 } else if (direction_ == SERVER) {
684 HandleIncomingCall(std::move(inbound_));
685 } else {
686 LOG(FATAL) << "Invalid direction: " << direction_;
687 }
688
689 if (extra_buf.size() > 0) {
690 inbound_.reset(new InboundTransfer(std::move(extra_buf)));
691 } else {
692 break;
693 }
694 }
695}
696
697void Connection::HandleIncomingCall(unique_ptr<InboundTransfer> transfer) {
698 DCHECK(reactor_thread_->IsCurrentThread());

Callers

nothing calls this directly

Calls 15

NetworkErrorFunction · 0.85
moveFunction · 0.85
DestroyConnectionMethod · 0.80
cur_timeMethod · 0.80
ReceiveBufferMethod · 0.80
posix_codeMethod · 0.80
TransferFinishedMethod · 0.80
resetMethod · 0.65
getMethod · 0.65
ToStringFunction · 0.50
IsCurrentThreadMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected