mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
http: pipelining: fixes from xenial sai
This commit is contained in:
parent
63c8a23776
commit
eca75ee14d
4 changed files with 22 additions and 8 deletions
|
@ -1424,6 +1424,10 @@ lws_get_vhost_by_name(struct lws_context *context, const char *name)
|
|||
*
|
||||
* This was originally in the client code but since the list is held on the
|
||||
* vhost (to ensure the same client tls ctx is involved) it's cleaner in vhost.c
|
||||
*
|
||||
* ACTIVE_CONNS_QUEUED: We're queued on an active connection, set *nwsi to that
|
||||
* ACTIVE_CONNS_MUXED: We are joining an active mux conn *nwsi as a child
|
||||
* ACTIVE_CONNS_SOLO: There's no existing conn to join either way
|
||||
*/
|
||||
|
||||
int
|
||||
|
|
|
@ -192,7 +192,8 @@ send_hs:
|
|||
} else {
|
||||
lwsl_info("%s: wsi %p: %s %s client created own conn (raw %d) vh %sm st 0x%x\n",
|
||||
__func__, wsi, wsi->role_ops->name,
|
||||
wsi->protocol->name, rawish, wsi->vhost->name, lwsi_state(wsi));
|
||||
wsi->protocol->name, rawish, wsi->vhost->name,
|
||||
lwsi_state(wsi));
|
||||
|
||||
/* we are making our own connection */
|
||||
|
||||
|
@ -231,9 +232,10 @@ send_hs:
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!rawish)
|
||||
lwsi_set_state(wsi, LRS_H1C_ISSUE_HANDSHAKE);
|
||||
else {
|
||||
if (!rawish) {
|
||||
if (lwsi_state(wsi) != LRS_H1C_ISSUE_HANDSHAKE2)
|
||||
lwsi_set_state(wsi, LRS_H1C_ISSUE_HANDSHAKE);
|
||||
} else {
|
||||
/* for a method = "RAW" connection, this makes us
|
||||
* established */
|
||||
|
||||
|
@ -848,6 +850,13 @@ lws_client_connect_2_dnsreq(struct lws *wsi)
|
|||
|
||||
return wsi;
|
||||
case ACTIVE_CONNS_QUEUED:
|
||||
if (lwsi_state(wsi) == LRS_UNCONNECTED) {
|
||||
if (lwsi_role_h2(w))
|
||||
lwsi_set_state(wsi, LRS_H2_WAITING_TO_SEND_HEADERS);
|
||||
else
|
||||
lwsi_set_state(wsi, LRS_H1C_ISSUE_HANDSHAKE2);
|
||||
}
|
||||
|
||||
return lws_client_connect_4_established(wsi, w, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -471,7 +471,8 @@ client_http_body_sent:
|
|||
return lws_client_interpret_server_handshake(wsi);
|
||||
|
||||
bail3:
|
||||
lwsl_info("closing conn at LWS_CONNMODE...SERVER_REPLY\n");
|
||||
lwsl_info("%s: closing conn at LWS_CONNMODE...SERVER_REPLY, wsi %p, state 0x%x\n",
|
||||
__func__, wsi, lwsi_state(wsi));
|
||||
if (cce)
|
||||
lwsl_info("reason: %s\n", cce);
|
||||
lws_inform_client_conn_fail(wsi, (void *)cce, strlen(cce));
|
||||
|
|
|
@ -44,7 +44,7 @@ static int completed, failed, numbered, stagger_idx, posting, count = COUNT;
|
|||
static lws_sorted_usec_list_t sul_stagger;
|
||||
static struct lws_client_connect_info i;
|
||||
static struct lws *client_wsi[COUNT];
|
||||
static char urlpath[64];
|
||||
static char urlpath[64], intr;
|
||||
static struct lws_context *context;
|
||||
|
||||
/* we only need this for tracking POST emit state */
|
||||
|
@ -198,7 +198,7 @@ finished:
|
|||
lwsl_user("Done: all OK\n");
|
||||
else
|
||||
lwsl_err("Done: failed: %d\n", failed);
|
||||
//interrupted = 1;
|
||||
intr = 1;
|
||||
/*
|
||||
* This is how we can exit the event loop even when it's an
|
||||
* event library backing it... it will start and stage the
|
||||
|
@ -459,7 +459,7 @@ int main(int argc, const char **argv)
|
|||
100 * LWS_US_PER_MS);
|
||||
|
||||
start = us();
|
||||
while (!lws_service(context, 0))
|
||||
while (!intr && !lws_service(context, 0))
|
||||
;
|
||||
|
||||
lwsl_user("Duration: %lldms\n", (us() - start) / 1000);
|
||||
|
|
Loading…
Add table
Reference in a new issue