From 8de6e5fcf07c57cd53e759dfad96ecee219b6725 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Wed, 15 Aug 2018 12:49:32 +0800 Subject: [PATCH] client: allow pipelined http to call LWS_CALLBACK_CLOSED_CLIENT_HTTP --- lib/core/libwebsockets.c | 4 +++- lib/roles/http/client/client.c | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/core/libwebsockets.c b/lib/core/libwebsockets.c index 4c095aec85..2cca7ba3ee 100644 --- a/lib/core/libwebsockets.c +++ b/lib/core/libwebsockets.c @@ -888,7 +888,9 @@ __lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason, const char * /* tell the user it's all over for this guy */ - if (lwsi_state_est_PRE_CLOSE(wsi) && !wsi->told_user_closed && + if ((lwsi_state_est_PRE_CLOSE(wsi) || + lwsi_state_PRE_CLOSE(wsi) == LRS_WAITING_SERVER_REPLY) && + !wsi->told_user_closed && wsi->role_ops->close_cb[lwsi_role_server(wsi)]) { const struct lws_protocols *pro = wsi->protocol; diff --git a/lib/roles/http/client/client.c b/lib/roles/http/client/client.c index 8aba185b86..d80c64a04d 100644 --- a/lib/roles/http/client/client.c +++ b/lib/roles/http/client/client.c @@ -549,11 +549,12 @@ lws_http_transaction_completed_client(struct lws *wsi) { struct lws *wsi_eff = lws_client_wsi_effective(wsi); - lwsl_info("%s: wsi: %p, wsi_eff: %p\n", __func__, wsi, wsi_eff); + lwsl_info("%s: wsi: %p, wsi_eff: %p (%s)\n", __func__, wsi, wsi_eff, + wsi_eff->protocol->name); - if (user_callback_handle_rxflow(wsi_eff->protocol->callback, - wsi_eff, LWS_CALLBACK_COMPLETED_CLIENT_HTTP, - wsi_eff->user_space, NULL, 0)) { + if (user_callback_handle_rxflow(wsi_eff->protocol->callback, wsi_eff, + LWS_CALLBACK_COMPLETED_CLIENT_HTTP, + wsi_eff->user_space, NULL, 0)) { lwsl_debug("%s: Completed call returned nonzero (role 0x%x)\n", __func__, lwsi_role(wsi_eff)); return -1;