| 748 | } |
| 749 | |
| 750 | void Connection::WriteHandler(ev::io &watcher, int revents) { |
| 751 | DCHECK(reactor_thread_->IsCurrentThread()); |
| 752 | |
| 753 | if (revents & EV_ERROR) { |
| 754 | reactor_thread_->DestroyConnection(this, Status::NetworkError(ToString() + |
| 755 | ": writeHandler encountered an error")); |
| 756 | return; |
| 757 | } |
| 758 | DVLOG(3) << ToString() << ": writeHandler: revents = " << revents; |
| 759 | |
| 760 | if (outbound_transfers_.empty()) { |
| 761 | LOG(WARNING) << ToString() << " got a ready-to-write callback, but there is " |
| 762 | "nothing to write."; |
| 763 | write_io_.stop(); |
| 764 | return; |
| 765 | } |
| 766 | if (ProcessOutboundTransfers() == kNoMoreToSend) { |
| 767 | write_io_.stop(); |
| 768 | } |
| 769 | } |
| 770 | |
| 771 | Connection::ProcessOutboundTransfersResult Connection::ProcessOutboundTransfers() { |
| 772 | while (!outbound_transfers_.empty()) { |
nothing calls this directly
no test coverage detected