1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

ss: mark client wsi bound to ss using flag

This commit is contained in:
Andy Green 2020-12-21 23:16:10 +00:00
parent 83feefe288
commit 5947e54a66
4 changed files with 12 additions and 2 deletions

View file

@ -72,6 +72,8 @@ enum lws_client_connect_ssl_connection_flags {
* means you may block other connection processing in favour of incoming
* data processing on this one if it receives back to back incoming rx.
*/
LCCSCF_SECSTREAM_CLIENT = (1 << 21),
/**< used to mark client wsi as bound to secure stream */
};
/** struct lws_client_connect_info - parameters to connect with when using

View file

@ -326,6 +326,12 @@ lws_client_connect_via_info(const struct lws_client_connect_info *i)
wsi->a.opaque_user_data = wsi->stash->opaque_user_data =
i->opaque_user_data;
#if defined(LWS_WITH_SECURE_STREAMS)
wsi->for_ss = !!(i->ssl_connection & LCCSCF_SECSTREAM_CLIENT);
/* implies our opaque user ptr is the ss handle */
#endif
pc = (char *)&wsi->stash[1];
for (n = 0; n < CIS_COUNT; n++)

View file

@ -162,7 +162,7 @@ __lws_free_wsi(struct lws *wsi)
if (!wsi)
return;
#if defined(LWS_WITH_SECURE_STREAMS) && defined(LWS_WITH_SERVER)
#if defined(LWS_WITH_SECURE_STREAMS)
if (wsi->for_ss) {
/*
* Make certain it is disconnected from the ss by now
@ -520,7 +520,7 @@ just_kill_connection:
*/
lws_ss_handle_t *h = (lws_ss_handle_t *)wsi->a.opaque_user_data;
if (h && !(h->info.flags & LWSSSINFLAGS_ACCEPTED)) {
if (h && (h->info.flags & LWSSSINFLAGS_ACCEPTED)) {
h->wsi = NULL;
wsi->a.opaque_user_data = NULL;
}

View file

@ -439,6 +439,8 @@ _lws_ss_client_connect(lws_ss_handle_t *h, int is_retry)
if (h->policy->flags & LWSSSPOLF_WAKE_SUSPEND__VALIDITY)
i.ssl_connection |= LCCSCF_WAKE_SUSPEND__VALIDITY;
i.ssl_connection |= LCCSCF_SECSTREAM_CLIENT;
i.address = ads;
i.port = port;
i.host = i.address;