ngtcp2_conn_write_connection_close: Return error if buffer is too small
@@ -7938,7 +7938,7 @@ ssize_t ngtcp2_conn_write_connection_close(ngtcp2_conn *conn, ngtcp2_path *path,
res += nwrite;
if (res == 0) {
- return 0;
+ return NGTCP2_ERR_NOBUF;
}
conn->state = NGTCP2_CS_CLOSING;
@@ -7981,10 +7981,16 @@ ssize_t ngtcp2_conn_write_application_close(ngtcp2_conn *conn,
&conn->dcid.current.cid, &fr,
NGTCP2_RTB_FLAG_NONE, ts);
- if (nwrite > 0) {
- conn->state = NGTCP2_CS_CLOSING;
+ if (nwrite < 0) {
+ return nwrite;
}
+ if (nwrite == 0) {
+ return NGTCP2_ERR_NOBUF;
+ }
+
+ conn->state = NGTCP2_CS_CLOSING;
+
return nwrite;
}
