diff --git a/CMakeLists.txt b/CMakeLists.txt index 3abeda51f..ffa141374 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,7 +356,7 @@ find_package(Git) if(GIT_EXECUTABLE) execute_process( WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - COMMAND "${GIT_EXECUTABLE}" describe --tags + COMMAND "${GIT_EXECUTABLE}" describe --tags --always OUTPUT_VARIABLE GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) diff --git a/lib/core-net/wsi.c b/lib/core-net/wsi.c index 46566100b..db77be39f 100644 --- a/lib/core-net/wsi.c +++ b/lib/core-net/wsi.c @@ -1066,6 +1066,12 @@ lws_wsi_client_stash_item(struct lws *wsi, int stash_idx, int hdr_idx) void lws_wsi_mux_insert(struct lws *wsi, struct lws *parent_wsi, int sid) { + lwsl_info("%s: wsi %p, par %p: assign sid %d (curr %d)\n", __func__, + wsi, parent_wsi, sid, wsi->mux.my_sid); + + if (wsi->mux.my_sid && wsi->mux.my_sid != (unsigned int)sid) + assert(0); + wsi->mux.my_sid = sid; wsi->mux.parent_wsi = parent_wsi; wsi->role_ops = parent_wsi->role_ops; @@ -1182,8 +1188,8 @@ lws_wsi_mux_mark_parents_needing_writeable(struct lws *wsi) wsi2 = wsi; while (wsi2) { wsi2->mux.requested_POLLOUT = 1; - lwsl_info("%s: mark %p (sid %u) pending writable\n", __func__, - wsi2, wsi2->mux.my_sid); + lwsl_info("%s: mark wsi: %p, sid %u, pending writable\n", + __func__, wsi2, wsi2->mux.my_sid); wsi2 = wsi2->mux.parent_wsi; } diff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c index d08084ae6..850380c03 100644 --- a/lib/roles/h2/http2.c +++ b/lib/roles/h2/http2.c @@ -248,6 +248,8 @@ lws_wsi_server_new(struct lws_vhost *vh, struct lws *parent_wsi, h2n->highest_sid_opened = sid; lws_wsi_mux_insert(wsi, parent_wsi, sid); + if (sid >= h2n->highest_sid) + h2n->highest_sid = sid + 2; wsi->mux_substream = 1; wsi->seen_nonpseudoheader = 0; @@ -319,6 +321,9 @@ lws_wsi_h2_adopt(struct lws *parent_wsi, struct lws *wsi) nwsi->h2.h2n->highest_sid += 2; } + lwsl_info("%s: binding wsi %p to sid %d (next %d)\n", __func__, + wsi, (int)wsi->mux.my_sid, (int)nwsi->h2.h2n->highest_sid); + lws_wsi_mux_insert(wsi, parent_wsi, wsi->mux.my_sid); wsi->txc.tx_cr = nwsi->h2.h2n->peer_set.s[H2SET_INITIAL_WINDOW_SIZE]; @@ -1219,6 +1224,9 @@ lws_h2_parse_frame_header(struct lws *wsi) return 1; } + if (h2n->sid >= h2n->highest_sid) + h2n->highest_sid = h2n->sid + 2; + h2n->swsi->h2.initialized = 1; if (lws_h2_update_peer_txcredit(h2n->swsi, @@ -1569,6 +1577,9 @@ lws_h2_parse_end_of_frame(struct lws *wsi) } switch (h2n->swsi->h2.h2_state) { + case LWS_H2_STATE_IDLE: + lws_h2_state(h2n->swsi, LWS_H2_STATE_OPEN); + break; case LWS_H2_STATE_OPEN: if (h2n->swsi->h2.END_STREAM) lws_h2_state(h2n->swsi, @@ -1582,7 +1593,8 @@ lws_h2_parse_end_of_frame(struct lws *wsi) #if defined(LWS_WITH_CLIENT) if (h2n->swsi->client_mux_substream) { - lwsl_info("%s: headers: client path\n", __func__); + lwsl_info("%s: wsi %p: headers: client path (h2 state %s)\n", + __func__, wsi, h2_state_names[h2n->swsi->h2.h2_state]); break; } #endif @@ -2318,7 +2330,13 @@ lws_h2_client_handshake(struct lws *wsi) lwsl_debug("%s\n", __func__); nwsi->h2.h2n->highest_sid_opened = sid; - wsi->mux.my_sid = sid; + if (!wsi->mux.my_sid) + wsi->mux.my_sid = sid; + else { + lwsl_debug("%s: %p already sid %d\n", + __func__, wsi, wsi->mux.my_sid); + //assert(0); + } lwsl_info("%s: CLIENT_WAITING_TO_SEND_HEADERS: pollout (sid %d)\n", __func__, wsi->mux.my_sid); @@ -2430,7 +2448,7 @@ lws_h2_client_handshake(struct lws *wsi) wsi->txc.manual = 1; } - if (lws_h2_update_peer_txcredit(wsi, sid, n)) + if (lws_h2_update_peer_txcredit(wsi, wsi->mux.my_sid, n)) return 1; lws_h2_state(wsi, LWS_H2_STATE_OPEN); diff --git a/lib/roles/h2/ops-h2.c b/lib/roles/h2/ops-h2.c index 56f2a8d6a..65b8f5093 100644 --- a/lib/roles/h2/ops-h2.c +++ b/lib/roles/h2/ops-h2.c @@ -859,8 +859,8 @@ rops_perform_user_POLLOUT_h2(struct lws *wsi) goto next_child; } - lwsl_info("%s: child %p (wsistate 0x%x)\n", __func__, w, - (unsigned int)w->wsistate); + lwsl_info("%s: child wsi %p, sid %d, (wsistate 0x%x)\n", + __func__, w, w->mux.my_sid, (unsigned int)w->wsistate); /* priority 1: post compression-transform buffered output */ diff --git a/lib/roles/http/client/client-http.c b/lib/roles/http/client/client-http.c index b5c9d9350..233395786 100644 --- a/lib/roles/http/client/client-http.c +++ b/lib/roles/http/client/client-http.c @@ -911,7 +911,7 @@ lws_client_interpret_server_handshake(struct lws *wsi) wsi->http.ah = ah1; - lwsl_info("%s: client connection up\n", __func__); + lwsl_info("%s: wsi %p: client connection up\n", __func__, wsi); /* * Did we get a response from the server with an explicit