- struct wps_event_ *e = cookie;
- struct subscription *s = e->s;
- struct upnp_wps_device_sm *sm = s->sm;
- struct httpread *hread = e->hread;
- int reply_code = 0;
-
- assert(e == s->current_event);
- eloop_cancel_timeout(event_timeout_handler, NULL, e);
-
- if (en == HTTPREAD_EVENT_FILE_READY) {
- if (httpread_hdr_type_get(hread) == HTTPREAD_HDR_TYPE_REPLY) {
- reply_code = httpread_reply_code_get(hread);
- if (reply_code == HTTP_OK) {
- wpa_printf(MSG_DEBUG,
- "WPS UPnP: Got event reply OK from "
- "%s", e->addr->domain_and_port);
- event_delete(e);
- goto send_more;
- } else {
- wpa_printf(MSG_DEBUG, "WPS UPnP: Got event "
- "error reply code %d from %s",
- reply_code,
- e->addr->domain_and_port);
- goto bad;
- }
- } else {
- wpa_printf(MSG_DEBUG, "WPS UPnP: Got bogus event "
- "response %d from %s", en,
- e->addr->domain_and_port);
- }
- } else {
- wpa_printf(MSG_DEBUG, "WPS UPnP: Event response timeout/fail "
- "for %s", e->addr->domain_and_port);
- goto bad;
- }
- event_retry(e, 1);
- goto send_more;
-
-send_more:
- /* Schedule sending more if there is more to send */
- if (s->event_queue)
- event_send_all_later(sm);
- return;
-
-bad:
- /*
- * If other side doesn't like what we say, forget about them.
- * (There is no way to tell other side that we are dropping
- * them...).
- * Alternately, we could just do event_delete(e)
- */
- wpa_printf(MSG_DEBUG, "WPS UPnP: Deleting subscription due to errors");
- subscription_unlink(s);
- subscription_destroy(s);
-}
-
-
-/* event_send_tx_ready -- actually write event message
- *
- * Prequisite: subscription socket descriptor has become ready to
- * write (because connection to subscriber has been made).
- *
- * It is also possible that we are called because the connect has failed;
- * it is possible to test for this, or we can just go ahead and then
- * the write will fail.
- */
-static void event_send_tx_ready(int sock, void *eloop_ctx, void *sock_ctx)
-{
- struct wps_event_ *e = sock_ctx;
- struct subscription *s = e->s;