Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
upnp: add debug fcn to dump output packets
  • Loading branch information
perexg committed Mar 11, 2015
1 parent 53984a3 commit 3e33da5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/upnp.c
Expand Up @@ -101,6 +101,20 @@ upnp_send( htsbuf_queue_t *q, struct sockaddr_storage *storage, int delay_ms )
pthread_mutex_unlock(&upnp_lock);
}

/*
*
*/
static void
upnp_dump_data( upnp_data_t *data )
{
#if 0
char tbuf[256];
inet_ntop(data->storage.ss_family, IP_IN_ADDR(data->storage), tbuf, sizeof(tbuf));
printf("upnp out to %s:%d\n", tbuf, ntohs(IP_PORT(data->storage)));
htsbuf_hexdump(&data->queue, "upnp out");
#endif
}

/*
* Discovery thread
*/
Expand Down Expand Up @@ -183,6 +197,7 @@ upnp_thread( void *aux )
pthread_mutex_unlock(&upnp_lock);
if (data == NULL)
break;
upnp_dump_data(data);
udp_write_queue(unicast, &data->queue, &data->storage);
htsbuf_queue_flush(&data->queue);
free(data);
Expand All @@ -200,6 +215,7 @@ upnp_thread( void *aux )
if (data == NULL)
break;
usleep((long)data->delay_ms * 1000);
upnp_dump_data(data);
udp_write_queue(unicast, &data->queue, &data->storage);
htsbuf_queue_flush(&data->queue);
free(data);
Expand Down

0 comments on commit 3e33da5

Please sign in to comment.