| 119 | } |
| 120 | |
| 121 | void TBufferedTransport::flush() { |
| 122 | resetConsumedMessageSize(); |
| 123 | // Write out any data waiting in the write buffer. |
| 124 | auto have_bytes = static_cast<uint32_t>(wBase_ - wBuf_.get()); |
| 125 | if (have_bytes > 0) { |
| 126 | // Note that we reset wBase_ prior to the underlying write |
| 127 | // to ensure we're in a sane state (i.e. internal buffer cleaned) |
| 128 | // if the underlying write throws up an exception |
| 129 | wBase_ = wBuf_.get(); |
| 130 | transport_->write(wBuf_.get(), have_bytes); |
| 131 | } |
| 132 | |
| 133 | // Flush the underlying transport. |
| 134 | transport_->flush(); |
| 135 | } |
| 136 | |
| 137 | uint32_t TFramedTransport::readSlow(uint8_t* buf, uint32_t len) { |
| 138 | uint32_t want = len; |