miniupnpc-async: reduce output when not compiled with -DDEBUG

This commit is contained in:
Thomas Bernard 2014-11-07 13:12:48 +01:00
parent 4a15b5dec0
commit 30b9acd087
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $Id: miniupnpc-async.c,v 1.18 2014/11/07 11:25:52 nanard Exp $ */
/* $Id: miniupnpc-async.c,v 1.19 2014/11/07 12:05:40 nanard Exp $ */
/* miniupnpc-async
* Copyright (c) 2008-2014, Thomas BERNARD <miniupnp@free.fr>
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
@ -490,7 +490,7 @@ static int upnpc_parse_headers(upnpc_t * p)
} else if(p->http_response[i + 1] == '\r' ||
p->http_response[i + 1] == '\n') {
if(colon > linestart && valuestart > colon) {
printf("header='%.*s', value='%.*s'\n",
debug_printf("header='%.*s', value='%.*s'\n",
colon-linestart, p->http_response+linestart,
i+1-valuestart, p->http_response+valuestart);
if(0==strncasecmp(p->http_response+linestart, "content-length", colon-linestart)) {

View File

@ -1,4 +1,4 @@
/* $Id: testasync.c,v 1.13 2014/11/07 11:25:52 nanard Exp $ */
/* $Id: testasync.c,v 1.14 2014/11/07 12:07:38 nanard Exp $ */
/* miniupnpc-async
* Copyright (c) 2008-2014, Thomas BERNARD <miniupnp@free.fr>
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
@ -61,13 +61,19 @@ int main(int argc, char * * argv)
timeout.tv_sec = 0;
timeout.tv_usec = 0;
#endif
#if DEBUG
printf("select(%d, ...);\n", nfds+1);
#endif /* DEBUG */
if(select(nfds+1, &readfds, &writefds, NULL, NULL/*&timeout*/) < 0) {
perror("select");
return 1;
}
r = upnpc_process(&upnp);
#if DEBUG
printf("upnpc_process returned %d\n", r);
#endif /* DEBUG */
if(r < 0)
break;
if(upnp.state == EReady) {
char * p;
printf("Process UPnP IGD Method results : HTTP %d\n", upnp.http_response_code);