diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-09-14 21:04:12 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-09-14 21:04:12 +0200 |
commit | 13a263894ae13460803d2f7fb1ec3efadaeb79d1 (patch) | |
tree | 42c42df9e482324d27d72d1b4c5ead405eaec0e9 /external/miniupnpc/miniupnpcmodule.c | |
parent | Merge pull request #2438 (diff) | |
parent | update miniupnpc (diff) | |
download | monero-13a263894ae13460803d2f7fb1ec3efadaeb79d1.tar.xz |
Merge pull request #2378
b338dad2 update miniupnpc (MaxXor)
Diffstat (limited to 'external/miniupnpc/miniupnpcmodule.c')
-rw-r--r-- | external/miniupnpc/miniupnpcmodule.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/external/miniupnpc/miniupnpcmodule.c b/external/miniupnpc/miniupnpcmodule.c index fd970476c..8ffbf51a1 100644 --- a/external/miniupnpc/miniupnpcmodule.c +++ b/external/miniupnpc/miniupnpcmodule.c @@ -2,7 +2,7 @@ /* Project : miniupnp * Author : Thomas BERNARD * website : http://miniupnp.tuxfamily.org/ - * copyright (c) 2007-2014 Thomas Bernard + * copyright (c) 2007-2016 Thomas Bernard * This software is subjet to the conditions detailed in the * provided LICENCE file. */ #include <Python.h> @@ -12,6 +12,10 @@ #include "upnpcommands.h" #include "upnperrors.h" +#ifdef _WIN32 +#include <winsock2.h> +#endif + /* for compatibility with Python < 2.4 */ #ifndef Py_RETURN_NONE #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None @@ -303,7 +307,7 @@ UPnP_addportmapping(UPnPObject *self, PyObject *args) const char * remoteHost; const char * leaseDuration = "0"; int r; - if (!PyArg_ParseTuple(args, "HssHss", &ePort, &proto, + if (!PyArg_ParseTuple(args, "HssHzz", &ePort, &proto, &host, &iPort, &desc, &remoteHost)) return NULL; Py_BEGIN_ALLOW_THREADS @@ -345,7 +349,7 @@ UPnP_addanyportmapping(UPnPObject *self, PyObject *args) const char * remoteHost; const char * leaseDuration = "0"; int r; - if (!PyArg_ParseTuple(args, "HssHss", &ePort, &proto, &host, &iPort, &desc, &remoteHost)) + if (!PyArg_ParseTuple(args, "HssHzz", &ePort, &proto, &host, &iPort, &desc, &remoteHost)) return NULL; Py_BEGIN_ALLOW_THREADS sprintf(extPort, "%hu", ePort); @@ -669,6 +673,10 @@ initminiupnpc(void) PyObject* m; #ifdef _WIN32 + /* initialize Winsock. */ + WSADATA wsaData; + int nResult = WSAStartup(MAKEWORD(2,2), &wsaData); + UPnPType.tp_new = PyType_GenericNew; #endif if (PyType_Ready(&UPnPType) < 0) |