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

ss: fetch_policy cleanup

This commit is contained in:
Andy Green 2020-12-21 23:21:15 +00:00
parent 5947e54a66
commit da30c6483f
2 changed files with 27 additions and 5 deletions

View file

@ -214,12 +214,22 @@ lws_state_notify_protocol_init(struct lws_state_manager *mgr,
*/
if (target == LWS_SYSTATE_POLICY_VALID &&
context->pss_policies && !context->policy_updated) {
if (context->hss_fetch_policy)
return 1;
lwsl_debug("%s: starting policy fetch\n", __func__);
/*
* Start trying to acquire it if it's not already in progress
* returns nonzero if we determine it's not needed
*/
if (!lws_ss_sys_fetch_policy(context))
return 1;
/* we have it */
return 0;
/* deny while we fetch it */
return 1;
}
#endif
#endif

View file

@ -107,8 +107,16 @@ ss_fetch_policy_state(void *userobj, void *sh, lws_ss_constate_t state,
case LWSSSCS_CONNECTING:
break;
case LWSSSCS_QOS_ACK_REMOTE:
switch (m->partway) {
case 2:
lws_sul_schedule(context, 0, &m->sul, policy_set, 1);
break;
}
break;
case LWSSSCS_DISCONNECTED:
lwsl_info("%s: DISCONNECTED\n", __func__);
lwsl_notice("%s: DISCONNECTED\n", __func__);
switch (m->partway) {
case 1:
lws_ss_policy_parse_abandon(context);
@ -154,10 +162,14 @@ lws_ss_sys_fetch_policy(struct lws_context *context)
* running on a proxied client with no policy of its own,
* it's OK.
*/
lwsl_info("%s: Create LWA auth ss failed (policy?)\n", __func__);
lwsl_info("%s: Policy fetch ss failed (stub policy?)\n", __func__);
return 1;
return 0;
}
return 0;
lwsl_info("%s: policy fetching ongoing\n", __func__);
/* fetching it is ongoing */
return 1;
}