diff --git a/lib/secure-streams/private-lib-secure-streams.h b/lib/secure-streams/private-lib-secure-streams.h index f0dd85852..d88561f99 100644 --- a/lib/secure-streams/private-lib-secure-streams.h +++ b/lib/secure-streams/private-lib-secure-streams.h @@ -377,6 +377,9 @@ int lws_ss_exp_cb_metadata(void *priv, const char *name, char *out, size_t *pos, size_t olen, size_t *exp_ofs); +int +_lws_ss_client_connect(lws_ss_handle_t *h, int is_retry); + int lws_ss_sys_cpd(struct lws_context *cx); diff --git a/lib/secure-streams/secure-streams-serialize.c b/lib/secure-streams/secure-streams-serialize.c index ecf326ce1..db24f14a5 100644 --- a/lib/secure-streams/secure-streams-serialize.c +++ b/lib/secure-streams/secure-streams-serialize.c @@ -351,7 +351,7 @@ lws_ss_deserialize_parse(struct lws_ss_serialization_parser *par, goto hangup; par->ps = RPAR_TYPE; if (*pss) - lws_ss_client_connect(*pss); + _lws_ss_client_connect(*pss, 0); break; case LWSSS_SER_TXPRE_STREAMTYPE: diff --git a/lib/secure-streams/secure-streams.c b/lib/secure-streams/secure-streams.c index 4ffd5a9a7..36880f7be 100644 --- a/lib/secure-streams/secure-streams.c +++ b/lib/secure-streams/secure-streams.c @@ -294,12 +294,8 @@ lws_ss_smd_tx_cb(lws_sorted_usec_list_t *sul) #endif -/* - * This is a local SS binding to a local SMD server - */ - int -lws_ss_client_connect(lws_ss_handle_t *h) +_lws_ss_client_connect(lws_ss_handle_t *h, int is_retry) { const char *prot, *_prot, *ipath, *_ipath, *ads, *_ads; struct lws_client_connect_info i; @@ -323,6 +319,9 @@ lws_ss_client_connect(lws_ss_handle_t *h) if (h->h_sink) return 0; + if (!is_retry) + h->retry = 0; + #if defined(LWS_WITH_SYS_SMD) if (h->policy == &pol_smd) { @@ -473,6 +472,12 @@ lws_ss_client_connect(lws_ss_handle_t *h) return 0; } +int +lws_ss_client_connect(lws_ss_handle_t *h) +{ + return _lws_ss_client_connect(h, 0); +} + /* * Public API */ @@ -661,7 +666,7 @@ late_bail: ) #endif )) - if (lws_ss_client_connect(h)) + if (_lws_ss_client_connect(h, 0)) lws_ss_backoff(h); return 0; @@ -760,7 +765,11 @@ lws_ss_request_tx(lws_ss_handle_t *h) h->seqstate = SSSEQ_TRY_CONNECT; lws_ss_event_helper(h, LWSSSCS_POLL); - if (lws_ss_client_connect(h)) + /* + * Retries operate via lws_ss_request_tx(), explicitly ask for a + * reconnection to clear the retry limit + */ + if (_lws_ss_client_connect(h, 1)) lws_ss_backoff(h); }