mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 19:57:48 +02:00
[upnp] fix code
This commit is contained in:
parent
06066a4df5
commit
2f516d03a5
2 changed files with 56 additions and 54 deletions
|
@ -79,9 +79,10 @@ namespace transport
|
||||||
|
|
||||||
void UPnP::Discover ()
|
void UPnP::Discover ()
|
||||||
{
|
{
|
||||||
|
bool isError;
|
||||||
|
|
||||||
#if (MINIUPNPC_API_VERSION >= 8)
|
#if (MINIUPNPC_API_VERSION >= 8)
|
||||||
int err = UPNPDISCOVER_SUCCESS;
|
int err = UPNPDISCOVER_SUCCESS;
|
||||||
bool isError;
|
|
||||||
|
|
||||||
#if (MINIUPNPC_API_VERSION >= 14)
|
#if (MINIUPNPC_API_VERSION >= 14)
|
||||||
m_Devlist = upnpDiscover (UPNP_RESPONSE_TIMEOUT, NULL, NULL, 0, 0, 2, &err);
|
m_Devlist = upnpDiscover (UPNP_RESPONSE_TIMEOUT, NULL, NULL, 0, 0, 2, &err);
|
||||||
|
@ -92,7 +93,7 @@ namespace transport
|
||||||
isError = err != UPNPDISCOVER_SUCCESS;
|
isError = err != UPNPDISCOVER_SUCCESS;
|
||||||
#else
|
#else
|
||||||
m_Devlist = upnpDiscover (UPNP_RESPONSE_TIMEOUT, NULL, NULL, 0);
|
m_Devlist = upnpDiscover (UPNP_RESPONSE_TIMEOUT, NULL, NULL, 0);
|
||||||
isError = err == NULL;
|
isError = m_Devlist == NULL;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
// notify starting thread
|
// notify starting thread
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
namespace transport
|
namespace transport
|
||||||
{
|
{
|
||||||
const int UPNP_RESPONSE_TIMEOUT = 2000; // in milliseconds
|
const int UPNP_RESPONSE_TIMEOUT = 2000; // in milliseconds
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
@ -68,21 +68,22 @@ namespace i2p
|
||||||
char m_NetworkAddr[64];
|
char m_NetworkAddr[64];
|
||||||
char m_externalIPAddress[40];
|
char m_externalIPAddress[40];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // USE_UPNP
|
#else // USE_UPNP
|
||||||
namespace i2p {
|
namespace i2p {
|
||||||
namespace transport {
|
namespace transport {
|
||||||
/* class stub */
|
/* class stub */
|
||||||
class UPnP {
|
class UPnP {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UPnP () {};
|
UPnP () {};
|
||||||
~UPnP () {};
|
~UPnP () {};
|
||||||
void Start () { LogPrint(eLogWarning, "UPnP: this module was disabled at compile-time"); }
|
void Start () { LogPrint(eLogWarning, "UPnP: this module was disabled at compile-time"); }
|
||||||
void Stop () {};
|
void Stop () {};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // USE_UPNP
|
#endif // USE_UPNP
|
||||||
#endif // __UPNP_H__
|
#endif // __UPNP_H__
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue