From e606a409d996026ef433a5678a980edd60396fab Mon Sep 17 00:00:00 2001
From: Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Date: Sun, 3 Feb 2019 16:50:25 +0900
Subject: [PATCH] Don't apply CWND to PATH_CHALLENGE/PATH_RESPONSE only packet
 for now

---
 lib/ngtcp2_conn.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/ngtcp2_conn.c b/lib/ngtcp2_conn.c
index 41c73eca..dcc7b997 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) {
-- 
GitLab