diff --git a/lib/ngtcp2_conn.c b/lib/ngtcp2_conn.c index 41c73ecaab77378d53a522293be0362dffe3d6f0..dcc7b99713dcf4f23a6969defc9b604db2abc5e1 100644 --- a/lib/ngtcp2_conn.c +++ b/lib/ngtcp2_conn.c @@ -3068,9 +3068,6 @@ ssize_t ngtcp2_conn_write_pkt(ngtcp2_conn *conn, ngtcp2_path *path, return rv; } - cwnd = conn_cwnd_left(conn); - destlen = ngtcp2_min(destlen, cwnd); - nwrite = conn_write_path_response(conn, path, dest, destlen); if (nwrite) { return nwrite; @@ -3083,6 +3080,9 @@ ssize_t ngtcp2_conn_write_pkt(ngtcp2_conn *conn, ngtcp2_path *path, } } + cwnd = conn_cwnd_left(conn); + destlen = ngtcp2_min(destlen, cwnd); + if (path) { ngtcp2_path_copy(path, &conn->dcid.path); } @@ -7563,9 +7563,6 @@ ssize_t ngtcp2_conn_writev_stream(ngtcp2_conn *conn, ngtcp2_path *path, return NGTCP2_ERR_STREAM_SHUT_WR; } - cwnd = conn_cwnd_left(conn); - destlen = ngtcp2_min(destlen, cwnd); - nwrite = conn_write_path_response(conn, path, dest, destlen); if (nwrite) { return nwrite; @@ -7578,6 +7575,9 @@ ssize_t ngtcp2_conn_writev_stream(ngtcp2_conn *conn, ngtcp2_path *path, } } + cwnd = conn_cwnd_left(conn); + destlen = ngtcp2_min(destlen, cwnd); + if (conn->server) { server_hs_tx_left = conn_server_hs_tx_left(conn); if (server_hs_tx_left == 0) {