| 156 | } |
| 157 | |
| 158 | int64_t |
| 159 | Http2CommonSession::xmit(const Http2TxFrame &frame, bool flush) |
| 160 | { |
| 161 | int64_t len = frame.write_to(this->write_buffer); |
| 162 | this->_pending_sending_data_size += len; |
| 163 | if (!flush) { |
| 164 | // Flush if we already use half of the buffer to avoid adding a new block to the chain. |
| 165 | // A frame size can be 16MB at maximum so blocks can be added, but that's fine. |
| 166 | if (this->_pending_sending_data_size >= this->_write_size_threshold) { |
| 167 | flush = true; |
| 168 | } else { |
| 169 | // Observe that schedule_transmit will only schedule the first time we |
| 170 | // don't flush because the threshold is not met. |
| 171 | this->connection_state.schedule_retransmit(HRTIME_MSECONDS(Http2::write_time_threshold)); |
| 172 | } |
| 173 | } |
| 174 | if (flush) { |
| 175 | this->flush(); |
| 176 | } |
| 177 | |
| 178 | return len; |
| 179 | } |
| 180 | |
| 181 | void |
| 182 | Http2CommonSession::flush() |
no test coverage detected