diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2011-12-12 14:33:47 -0500 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2011-12-12 14:33:47 -0500 |
commit | b379bc5eefb2bd0091c4b016e24a406d36454bfa (patch) | |
tree | 66e6a2b9a4cb398b6e03f7a82a09a3ffe559fd12 | |
parent | ba56a88ca5fae52ce5690553d97e4e8ac1338dfd (diff) | |
parent | 94b97046fdd7466564f77f1f6631d50a8521cf10 (diff) |
Merge branch 'restore_old_miniupnp_compat' into 0.4.x
-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 1907397fad..a4687731f7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1081,11 +1081,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; @@ -1097,8 +1103,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", |