Ensure complete packet is written

This commit is contained in:
Tatsuhiro Tsujikawa 2020-04-02 17:50:11 +09:00
parent 4b45142e72
commit 749015eb86
1 changed files with 11 additions and 3 deletions

View File

@ -647,7 +647,13 @@ int Client::write_quic() {
case NGTCP2_ERR_STREAM_SHUT_WR: case NGTCP2_ERR_STREAM_SHUT_WR:
if (nwrite == NGTCP2_ERR_STREAM_DATA_BLOCKED && if (nwrite == NGTCP2_ERR_STREAM_DATA_BLOCKED &&
ngtcp2_conn_get_max_data_left(quic.conn) == 0) { ngtcp2_conn_get_max_data_left(quic.conn) == 0) {
return 0; /* Call ngtcp2_conn_writev_stream to ensure that a complete
packet is written to the buffer. */
nwrite = ngtcp2_conn_writev_stream(
quic.conn, &ps.path, buf.data(), quic.max_pktlen, nullptr,
NGTCP2_WRITE_STREAM_FLAG_NONE, /* stream_id = */ 0, /* fin = */ 0,
nullptr, 0, timestamp(worker->loop));
break;
} }
if (s->block_stream(stream_id) != 0) { if (s->block_stream(stream_id) != 0) {
@ -662,9 +668,11 @@ int Client::write_quic() {
continue; continue;
} }
if (nwrite < 0) {
quic.last_error = quic::err_transport(nwrite); quic.last_error = quic::err_transport(nwrite);
return -1; return -1;
} }
}
quic_restart_pkt_timer(); quic_restart_pkt_timer();