mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
Sane TTL for UPnP API>=14 and remove old miniupnpc support
This commit is contained in:
parent
b0395933de
commit
8f3daad502
18
UPnP.cpp
18
UPnP.cpp
@ -121,17 +121,11 @@ namespace transport
|
|||||||
|
|
||||||
void UPnP::Discover ()
|
void UPnP::Discover ()
|
||||||
{
|
{
|
||||||
#ifndef UPNPDISCOVER_SUCCESS
|
|
||||||
/* miniupnpc 1.5 */
|
|
||||||
m_Devlist = upnpDiscoverFunc (2000, m_MulticastIf, m_Minissdpdpath, 0);
|
|
||||||
#else
|
|
||||||
/* miniupnpc 1.6 */
|
|
||||||
int nerror = 0;
|
int nerror = 0;
|
||||||
#if MINIUPNPC_API_VERSION >= 15
|
#if MINIUPNPC_API_VERSION >= 14
|
||||||
m_Devlist = upnpDiscoverFunc(2000, m_MulticastIf, m_Minissdpdpath, 0, 0, 0, &nerror);
|
m_Devlist = upnpDiscoverFunc (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, 2, &nerror);
|
||||||
#else
|
#else
|
||||||
m_Devlist = upnpDiscoverFunc(2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror);
|
m_Devlist = upnpDiscoverFunc (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
@ -177,13 +171,7 @@ namespace transport
|
|||||||
std::string strDesc = "I2Pd";
|
std::string strDesc = "I2Pd";
|
||||||
try {
|
try {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#ifndef UPNPDISCOVER_SUCCESS
|
|
||||||
/* miniupnpc 1.5 */
|
|
||||||
r = UPNP_AddPortMappingFunc (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0);
|
|
||||||
#else
|
|
||||||
/* miniupnpc 1.6 */
|
|
||||||
r = UPNP_AddPortMappingFunc (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0, "0");
|
r = UPNP_AddPortMappingFunc (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0, "0");
|
||||||
#endif
|
|
||||||
if (r!=UPNPCOMMAND_SUCCESS)
|
if (r!=UPNPCOMMAND_SUCCESS)
|
||||||
{
|
{
|
||||||
LogPrint (eLogError, "UPnP: AddPortMapping (", strPort.c_str () ,", ", strPort.c_str () ,", ", m_NetworkAddr, ") failed with code ", r);
|
LogPrint (eLogError, "UPnP: AddPortMapping (", strPort.c_str () ,", ", strPort.c_str () ,", ", m_NetworkAddr, ") failed with code ", r);
|
||||||
|
Loading…
Reference in New Issue
Block a user