31 lines
1.5 KiB
Diff
31 lines
1.5 KiB
Diff
|
--- extra/upnpc.cpp 2015-04-20 02:57:16.000000000 +0500
|
||
|
+++ extra/upnpc.new 2017-10-09 15:00:00.000000000 +0500
|
||
|
@@ -41,9 +41,13 @@
|
||
|
|
||
|
bool UPnPc::init()
|
||
|
{
|
||
|
- UPNPDev *devices = upnpDiscover(5000, SettingsManager::getInstance()->isDefault(SettingsManager::BIND_ADDRESS) ? 0 : SETTING(BIND_ADDRESS).c_str(), 0, 0
|
||
|
-#if (MINIUPNPC_API_VERSION == 8 || defined(MINIUPNPC16))
|
||
|
- , 0, 0);
|
||
|
+ UPNPDev *devices = upnpDiscover(5000, SettingsManager::getInstance()->isDefault(SettingsManager::BIND_ADDRESS) ? 0 : SETTING(BIND_ADDRESS).c_str(), NULL, 0
|
||
|
+#if (MINIUPNPC_API_VERSION >= 8 || defined(MINIUPNPC16))
|
||
|
+ , 0
|
||
|
+#if (MINIUPNPC_API_VERSION >= 14)
|
||
|
+ , 2
|
||
|
+#endif
|
||
|
+ , NULL);
|
||
|
#else
|
||
|
);
|
||
|
#endif
|
||
|
@@ -63,8 +67,8 @@
|
||
|
const string port_ = Util::toString(port);
|
||
|
|
||
|
return UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port_.c_str(), port_.c_str(),
|
||
|
- Util::getLocalIp().c_str(), description.c_str(), protocols[protocol], NULL
|
||
|
-#if (MINIUPNPC_API_VERSION == 8 || defined(MINIUPNPC16))
|
||
|
+ Util::getLocalIp(AF_INET).c_str(), description.c_str(), protocols[protocol], NULL
|
||
|
+#if (MINIUPNPC_API_VERSION >= 8 || defined(MINIUPNPC16))
|
||
|
, 0) == UPNPCOMMAND_SUCCESS;
|
||
|
#else
|
||
|
) == UPNPCOMMAND_SUCCESS;
|