parent
a21a35e003
commit
aa490867b3
miniupnpc
|
@ -1,6 +1,9 @@
|
|||
$Id: Changelog.txt,v 1.242 2019/12/23 23:35:40 nanard Exp $
|
||||
miniUPnP client Changelog.
|
||||
|
||||
2020/09/23:
|
||||
prevent infinite loop in upnpDiscover()
|
||||
|
||||
2020/02/16:
|
||||
Add Haiku support
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#if defined (__NetBSD__)
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
|
@ -841,7 +842,13 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||
/* Waiting for SSDP REPLY packet to M-SEARCH
|
||||
* if searchalltypes is set, enter the loop only
|
||||
* when the last deviceType is reached */
|
||||
if((sentok && !searchalltypes) || !deviceTypes[deviceIndex + 1]) do {
|
||||
if((sentok && !searchalltypes) || !deviceTypes[deviceIndex + 1]) {
|
||||
struct timeval start, current;
|
||||
if (gettimeofday(&start, NULL) < 0) {
|
||||
start.tv_sec = 0;
|
||||
start.tv_usec = 0;
|
||||
}
|
||||
do {
|
||||
n = receivedata(sudp, bufr, sizeof(bufr), delay, &scope_id);
|
||||
if (n < 0) {
|
||||
/* error */
|
||||
|
@ -906,8 +913,16 @@ ssdpDiscoverDevices(const char * const deviceTypes[],
|
|||
tmp->scope_id = scope_id;
|
||||
devlist = tmp;
|
||||
}
|
||||
if (gettimeofday(¤t, NULL) >= 0) {
|
||||
/* exit the loop if delay is reached */
|
||||
long interval = (current.tv_sec - start.tv_sec) * 1000;
|
||||
interval += (current.tv_usec - start.tv_usec) / 1000;
|
||||
if (interval > (long)delay)
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while(n > 0);
|
||||
}
|
||||
if(ipv6) {
|
||||
/* switch linklocal flag */
|
||||
if(linklocal) {
|
||||
|
|
Loading…
Reference in New Issue