mirror of
https://github.com/cygnusxi/CurecoinSource.git
synced 2025-07-27 07:34:41 +02:00
Merge pull request #42 from TheGoddessInari/fix-miniupnpc
Fix miniupnpc versioning.
This commit is contained in:
commit
4f9b816f48
32
src/net.cpp
32
src/net.cpp
@ -1028,13 +1028,17 @@ void ThreadMapPort2(void* parg)
|
||||
struct UPNPDev * devlist = 0;
|
||||
char lanaddr[64];
|
||||
|
||||
#ifndef UPNPDISCOVER_SUCCESS
|
||||
/* miniupnpc 1.5 */
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0);
|
||||
#else
|
||||
#if MINIUPNPC_API_VERSION >= 14
|
||||
/* miniupnpc >=1.9 */
|
||||
int error = 0;
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, 2, &error);
|
||||
#elif MINIUPNPC_API_VERSION >= 8
|
||||
/* miniupnpc 1.6 */
|
||||
int error = 0;
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error);
|
||||
#else
|
||||
/* miniupnpc 1.5 */
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0);
|
||||
#endif
|
||||
|
||||
struct UPNPUrls urls;
|
||||
@ -1062,14 +1066,14 @@ void ThreadMapPort2(void* parg)
|
||||
}
|
||||
|
||||
string strDesc = "curecoin " + FormatFullVersion();
|
||||
#ifndef UPNPDISCOVER_SUCCESS
|
||||
/* miniupnpc 1.5 */
|
||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
|
||||
#else
|
||||
#if MINIUPNPC_API_VERSION >= 8
|
||||
/* miniupnpc 1.6 */
|
||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
|
||||
#else
|
||||
/* miniupnpc 1.5 */
|
||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
|
||||
#endif
|
||||
|
||||
if(r!=UPNPCOMMAND_SUCCESS)
|
||||
@ -1089,14 +1093,14 @@ void ThreadMapPort2(void* parg)
|
||||
}
|
||||
if (i % 600 == 0) // Refresh every 20 minutes
|
||||
{
|
||||
#ifndef UPNPDISCOVER_SUCCESS
|
||||
/* miniupnpc 1.5 */
|
||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
|
||||
#else
|
||||
#if MINIUPNPC_API_VERSION >= 8
|
||||
/* miniupnpc 1.6 */
|
||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
|
||||
#else
|
||||
/* miniupnpc 1.5 */
|
||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
||||
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
|
||||
#endif
|
||||
|
||||
if(r!=UPNPCOMMAND_SUCCESS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user