|
36 | 36 | #include <miniupnpc/miniwget.h>
|
37 | 37 | #include <miniupnpc/upnpcommands.h>
|
38 | 38 | #include <miniupnpc/upnperrors.h>
|
| 39 | +// The minimum supported miniUPnPc API version is set to 10. This keeps compatibility |
| 40 | +// with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages. |
| 41 | +static_assert(MINIUPNPC_API_VERSION >= 10, "miniUPnPc API version >= 10 assumed"); |
39 | 42 | #endif
|
40 | 43 |
|
41 | 44 | #include <unordered_map>
|
@@ -1403,16 +1406,10 @@ static void ThreadMapPort()
|
1403 | 1406 | struct UPNPDev * devlist = nullptr;
|
1404 | 1407 | char lanaddr[64];
|
1405 | 1408 |
|
1406 |
| -#ifndef UPNPDISCOVER_SUCCESS |
1407 |
| - /* miniupnpc 1.5 */ |
1408 |
| - devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); |
1409 |
| -#elif MINIUPNPC_API_VERSION < 14 |
1410 |
| - /* miniupnpc 1.6 */ |
1411 | 1409 | int error = 0;
|
| 1410 | +#if MINIUPNPC_API_VERSION < 14 |
1412 | 1411 | devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error);
|
1413 | 1412 | #else
|
1414 |
| - /* miniupnpc 1.9.20150730 */ |
1415 |
| - int error = 0; |
1416 | 1413 | devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, 2, &error);
|
1417 | 1414 | #endif
|
1418 | 1415 |
|
@@ -1446,15 +1443,8 @@ static void ThreadMapPort()
|
1446 | 1443 | std::string strDesc = "Bitcoin " + FormatFullVersion();
|
1447 | 1444 |
|
1448 | 1445 | do {
|
1449 |
| -#ifndef UPNPDISCOVER_SUCCESS |
1450 |
| - /* miniupnpc 1.5 */ |
1451 |
| - r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, |
1452 |
| - port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0); |
1453 |
| -#else |
1454 |
| - /* miniupnpc 1.6 */ |
1455 | 1446 | r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
1456 | 1447 | port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
|
1457 |
| -#endif |
1458 | 1448 |
|
1459 | 1449 | if(r!=UPNPCOMMAND_SUCCESS)
|
1460 | 1450 | LogPrintf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
|
|
0 commit comments