parent
ef03e1bc21
commit
2adcf3f432
|
@ -3,7 +3,7 @@
|
||||||
* Project : miniupnp
|
* Project : miniupnp
|
||||||
* Author : Thomas BERNARD
|
* Author : Thomas BERNARD
|
||||||
* website : https://miniupnp.tuxfamily.org/
|
* website : https://miniupnp.tuxfamily.org/
|
||||||
* copyright (c) 2007-2020 Thomas Bernard
|
* copyright (c) 2007-2021 Thomas Bernard
|
||||||
* This software is subjet to the conditions detailed in the
|
* This software is subjet to the conditions detailed in the
|
||||||
* provided LICENCE file. */
|
* provided LICENCE file. */
|
||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
|
@ -122,9 +122,9 @@ UPnPObject_dealloc(UPnPObject *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
UPnP_discover(UPnPObject *self)
|
UPnP_discover(UPnPObject *self)
|
||||||
{
|
{
|
||||||
struct UPNPDev * dev;
|
int error = 0;
|
||||||
int i;
|
|
||||||
PyObject *res = NULL;
|
PyObject *res = NULL;
|
||||||
|
|
||||||
if(self->devlist)
|
if(self->devlist)
|
||||||
{
|
{
|
||||||
freeUPNPDevlist(self->devlist);
|
freeUPNPDevlist(self->devlist);
|
||||||
|
@ -137,13 +137,21 @@ UPnP_discover(UPnPObject *self)
|
||||||
(int)self->localport,
|
(int)self->localport,
|
||||||
0/*ip v6*/,
|
0/*ip v6*/,
|
||||||
2/* TTL */,
|
2/* TTL */,
|
||||||
0/*error */);
|
&error);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
/* Py_RETURN_NONE ??? */
|
/* Py_RETURN_NONE ??? */
|
||||||
for(dev = self->devlist, i = 0; dev; dev = dev->pNext)
|
if (self->devlist != NULL) {
|
||||||
i++;
|
struct UPNPDev * dev;
|
||||||
res = Py_BuildValue("i", i);
|
int i = 0;
|
||||||
return res;
|
|
||||||
|
for(dev = self->devlist; dev; dev = dev->pNext)
|
||||||
|
i++;
|
||||||
|
res = Py_BuildValue("i", i);
|
||||||
|
return res;
|
||||||
|
} else {
|
||||||
|
PyErr_SetString(PyExc_Exception, strupnperror(error));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
Loading…
Reference in New Issue