diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-12-12 11:32:48 -0800 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2011-12-12 11:32:48 -0800 |
commit | ca287d66f2f12ae3006daef831fbf00a4723e46d (patch) | |
tree | e745ac8db2c5b2c21e5b6af4a88651e0dcb65dd9 /src/net.cpp | |
parent | 189dbde9827667c8aaf9a25e9e99f0caaf709edb (diff) | |
parent | 94b97046fdd7466564f77f1f6631d50a8521cf10 (diff) |
Merge pull request #694 from luke-jr/restore_old_miniupnp_compat
Restore compatibility with miniupnpc 1.5 (without breaking miniupnp 1.6)
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index 199fb407f2..e0ac2abef0 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1132,11 +1132,17 @@ void ThreadMapPort2(void* parg) const char * rootdescurl = 0; const char * multicastif = 0; const char * minissdpdpath = 0; - int error = 0; struct UPNPDev * devlist = 0; char lanaddr[64]; +#ifndef UPNPDISCOVER_SUCCESS + /* miniupnpc 1.5 */ + devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); +#else + /* miniupnpc 1.6 */ + int error = 0; devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error); +#endif struct UPNPUrls urls; struct IGDdatas data; @@ -1148,8 +1154,15 @@ void ThreadMapPort2(void* parg) char intClient[16]; char intPort[6]; string strDesc = "Bitcoin " + FormatFullVersion(); +#ifndef UPNPDISCOVER_SUCCESS + /* miniupnpc 1.5 */ + r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, + port, port, lanaddr, strDesc.c_str(), "TCP", 0); +#else + /* miniupnpc 1.6 */ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port, port, lanaddr, strDesc.c_str(), "TCP", 0, "0"); +#endif if(r!=UPNPCOMMAND_SUCCESS) printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", |