/* event_send_all_later_handler -- actually send events as needed */
void event_send_all_later_handler(void *eloop_data, void *user_ctx)
{
	struct upnp_wps_device_sm *sm = user_ctx;
	struct subscription *s;
	struct subscription *s_old;
	int nerrors = 0;

	sm->event_send_all_queued = 0;
	s = sm->subscriptions;
	if (s == NULL)
		return;
	do {
		if (s->addr_list == NULL) {
			/* if we've given up on all addresses */
			wpa_printf(MSG_DEBUG, "WPS UPnP: Removing "
				   "subscription with no addresses");
			s_old = s;
			s = s_old->next;
			subscription_unlink(s_old);
			subscription_destroy(s_old);
		} else {
			if (s->current_event == NULL /* not busy */ &&
			    s->event_queue != NULL /* more to do */) {
				if (event_send_start(s))
					nerrors++;
			}
			s = s->next;
		}
	} while (sm->subscriptions != NULL && s != sm->subscriptions);

	if (nerrors) {
		/* Try again later */
		event_send_all_later(sm);
	}
}
Example #2
0
/* event_send_all_later_handler -- actually send events as needed */
static void event_send_all_later_handler(void *eloop_data, void *user_ctx)
{
	struct upnp_wps_device_sm *sm = user_ctx;
	struct subscription *s, *tmp;
	int nerrors = 0;

	sm->event_send_all_queued = 0;
	dl_list_for_each_safe(s, tmp, &sm->subscriptions, struct subscription,
			      list) {
		if (s->current_event == NULL /* not busy */ &&
		    !dl_list_empty(&s->event_queue) /* more to do */) {
			if (event_send_start(s))
				nerrors++;
		}
	}

	if (nerrors) {
		/* Try again later */
		event_send_all_later(sm);
	}
}