WPS: Add more debug info for UPnP operations
This commit is contained in:
parent
ed31b5ebcf
commit
3953627b35
3 changed files with 26 additions and 9 deletions
|
@ -42,7 +42,7 @@ struct http_client {
|
||||||
static void http_client_timeout(void *eloop_data, void *user_ctx)
|
static void http_client_timeout(void *eloop_data, void *user_ctx)
|
||||||
{
|
{
|
||||||
struct http_client *c = eloop_data;
|
struct http_client *c = eloop_data;
|
||||||
wpa_printf(MSG_DEBUG, "HTTP: Timeout");
|
wpa_printf(MSG_DEBUG, "HTTP: Timeout (c=%p)", c);
|
||||||
c->cb(c->cb_ctx, c, HTTP_CLIENT_TIMEOUT);
|
c->cb(c->cb_ctx, c, HTTP_CLIENT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,9 @@ static void http_client_got_response(struct httpread *handle, void *cookie,
|
||||||
{
|
{
|
||||||
struct http_client *c = cookie;
|
struct http_client *c = cookie;
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "HTTP: httpread callback: handle=%p cookie=%p "
|
||||||
|
"e=%d", handle, cookie, e);
|
||||||
|
|
||||||
eloop_cancel_timeout(http_client_timeout, c, NULL);
|
eloop_cancel_timeout(http_client_timeout, c, NULL);
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case HTTPREAD_EVENT_FILE_READY:
|
case HTTPREAD_EVENT_FILE_READY:
|
||||||
|
|
|
@ -501,7 +501,7 @@ static void upnp_wps_device_send_event(struct upnp_wps_device_sm *sm)
|
||||||
list) {
|
list) {
|
||||||
if (event_add(s, buf)) {
|
if (event_add(s, buf)) {
|
||||||
wpa_printf(MSG_INFO, "WPS UPnP: Dropping "
|
wpa_printf(MSG_INFO, "WPS UPnP: Dropping "
|
||||||
"subscriber due to event backlog");
|
"subscriber %p due to event backlog", s);
|
||||||
dl_list_del(&s->list);
|
dl_list_del(&s->list);
|
||||||
subscription_destroy(s);
|
subscription_destroy(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Copyright (c) 2000-2003 Intel Corporation
|
* Copyright (c) 2000-2003 Intel Corporation
|
||||||
* Copyright (c) 2006-2007 Sony Corporation
|
* Copyright (c) 2006-2007 Sony Corporation
|
||||||
* Copyright (c) 2008-2009 Atheros Communications
|
* Copyright (c) 2008-2009 Atheros Communications
|
||||||
* Copyright (c) 2009, Jouni Malinen <j@w1.fi>
|
* Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
|
||||||
*
|
*
|
||||||
* See wps_upnp.c for more details on licensing and code history.
|
* See wps_upnp.c for more details on licensing and code history.
|
||||||
*/
|
*/
|
||||||
|
@ -72,6 +72,7 @@ static void event_clean(struct wps_event_ *e)
|
||||||
*/
|
*/
|
||||||
static void event_delete(struct wps_event_ *e)
|
static void event_delete(struct wps_event_ *e)
|
||||||
{
|
{
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS UPnP: Delete event %p", e);
|
||||||
event_clean(e);
|
event_clean(e);
|
||||||
wpabuf_free(e->data);
|
wpabuf_free(e->data);
|
||||||
os_free(e);
|
os_free(e);
|
||||||
|
@ -85,8 +86,11 @@ static struct wps_event_ *event_dequeue(struct subscription *s)
|
||||||
{
|
{
|
||||||
struct wps_event_ *e;
|
struct wps_event_ *e;
|
||||||
e = dl_list_first(&s->event_queue, struct wps_event_, list);
|
e = dl_list_first(&s->event_queue, struct wps_event_, list);
|
||||||
if (e)
|
if (e) {
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS UPnP: Dequeue event %p for "
|
||||||
|
"subscription %p", e, s);
|
||||||
dl_list_del(&e->list);
|
dl_list_del(&e->list);
|
||||||
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +118,15 @@ static void event_retry(struct wps_event_ *e, int do_next_address)
|
||||||
struct subscription *s = e->s;
|
struct subscription *s = e->s;
|
||||||
struct upnp_wps_device_sm *sm = s->sm;
|
struct upnp_wps_device_sm *sm = s->sm;
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS UPnP: Retry event %p for subscription %p",
|
||||||
|
e, s);
|
||||||
event_clean(e);
|
event_clean(e);
|
||||||
/* will set: s->current_event = NULL; */
|
/* will set: s->current_event = NULL; */
|
||||||
|
|
||||||
if (do_next_address)
|
if (do_next_address) {
|
||||||
e->retry++;
|
e->retry++;
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS UPnP: Try address %d", e->retry);
|
||||||
|
}
|
||||||
if (e->retry >= dl_list_len(&s->addr_list)) {
|
if (e->retry >= dl_list_len(&s->addr_list)) {
|
||||||
wpa_printf(MSG_DEBUG, "WPS UPnP: Giving up on sending event "
|
wpa_printf(MSG_DEBUG, "WPS UPnP: Giving up on sending event "
|
||||||
"for %s", e->addr->domain_and_port);
|
"for %s", e->addr->domain_and_port);
|
||||||
|
@ -163,11 +171,13 @@ static void event_http_cb(void *ctx, struct http_client *c,
|
||||||
struct wps_event_ *e = ctx;
|
struct wps_event_ *e = ctx;
|
||||||
struct subscription *s = e->s;
|
struct subscription *s = e->s;
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP client callback: e=%p c=%p "
|
||||||
|
"event=%d", e, c, event);
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case HTTP_CLIENT_OK:
|
case HTTP_CLIENT_OK:
|
||||||
wpa_printf(MSG_DEBUG,
|
wpa_printf(MSG_DEBUG,
|
||||||
"WPS UPnP: Got event reply OK from "
|
"WPS UPnP: Got event %p reply OK from %s",
|
||||||
"%s", e->addr->domain_and_port);
|
e, e->addr->domain_and_port);
|
||||||
event_delete(e);
|
event_delete(e);
|
||||||
|
|
||||||
/* Schedule sending more if there is more to send */
|
/* Schedule sending more if there is more to send */
|
||||||
|
@ -330,10 +340,12 @@ void event_send_stop_all(struct upnp_wps_device_sm *sm)
|
||||||
int event_add(struct subscription *s, const struct wpabuf *data)
|
int event_add(struct subscription *s, const struct wpabuf *data)
|
||||||
{
|
{
|
||||||
struct wps_event_ *e;
|
struct wps_event_ *e;
|
||||||
|
unsigned int len;
|
||||||
|
|
||||||
if (dl_list_len(&s->event_queue) >= MAX_EVENTS_QUEUED) {
|
len = dl_list_len(&s->event_queue);
|
||||||
|
if (len >= MAX_EVENTS_QUEUED) {
|
||||||
wpa_printf(MSG_DEBUG, "WPS UPnP: Too many events queued for "
|
wpa_printf(MSG_DEBUG, "WPS UPnP: Too many events queued for "
|
||||||
"subscriber");
|
"subscriber %p", s);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,6 +362,8 @@ int event_add(struct subscription *s, const struct wpabuf *data)
|
||||||
e->subscriber_sequence = s->next_subscriber_sequence++;
|
e->subscriber_sequence = s->next_subscriber_sequence++;
|
||||||
if (s->next_subscriber_sequence == 0)
|
if (s->next_subscriber_sequence == 0)
|
||||||
s->next_subscriber_sequence++;
|
s->next_subscriber_sequence++;
|
||||||
|
wpa_printf(MSG_DEBUG, "WPS UPnP: Queue event %p for subscriber %p "
|
||||||
|
"(queue len %u)", e, s, len + 1);
|
||||||
dl_list_add_tail(&s->event_queue, &e->list);
|
dl_list_add_tail(&s->event_queue, &e->list);
|
||||||
event_send_all_later(s->sm);
|
event_send_all_later(s->sm);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue