From 227c1a0df2e79a2679362e04428026c5669ed507 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 24 May 2018 11:27:56 +0800 Subject: [PATCH] h2 client: no close callback for network stream --- lib/core/libwebsockets.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/core/libwebsockets.c b/lib/core/libwebsockets.c index 0da02b17..cc41600e 100644 --- a/lib/core/libwebsockets.c +++ b/lib/core/libwebsockets.c @@ -826,7 +826,15 @@ just_kill_connection: if (!wsi->protocol) pro = &wsi->vhost->protocols[0]; - pro->callback(wsi, + if (!wsi->upgraded_to_http2 || !lwsi_role_client(wsi)) + /* + * The network wsi for a client h2 connection shouldn't + * call back for its role: the child stream connections + * own the role. Otherwise h2 will call back closed + * one too many times as the children do it and then + * the closing network stream. + */ + pro->callback(wsi, wsi->role_ops->close_cb[lwsi_role_server(wsi)], wsi->user_space, NULL, 0); wsi->told_user_closed = 1;