diff options
-rw-r--r-- | src/DirectConnection.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/DirectConnection.cpp b/src/DirectConnection.cpp index 453f6b6..5cfafb7 100644 --- a/src/DirectConnection.cpp +++ b/src/DirectConnection.cpp @@ -50,7 +50,7 @@ namespace sibs { UDT::startup(); eid = UDT::epoll_create(); - //openPort(Ipv4(nullptr, port)); + openPort(Ipv4(nullptr, port)); receiveDataThread = std::thread(&DirectConnections::receiveData, this); } @@ -60,7 +60,6 @@ namespace sibs receiveDataThread.join(); peers.clear(); - /* for(UPNPUrlData &upnpDataItem : upnpData) { if(upnpDataItem.portOpened) @@ -72,7 +71,6 @@ namespace sibs if(upnpDevList) freeUPNPDevlist(upnpDevList); - */ UDT::epoll_release(eid); UDT::cleanup(); @@ -133,10 +131,10 @@ namespace sibs std::string inPort = extPort; std::string myIp = myAddress.getAddress(); const char *leaseDuration = "0"; // forever - r = UPNP_AddPortMapping(upnpUrl->controlURL, igdData->first.servicetype, extPort.c_str(), inPort.c_str(), myIp.c_str(), nullptr, "UDP", nullptr, leaseDuration); + r = UPNP_AddPortMapping(upnpUrl->controlURL, igdData->first.servicetype, extPort.c_str(), inPort.c_str(), lanAddr, nullptr, "UDP", nullptr, leaseDuration); if(r != UPNPCOMMAND_SUCCESS) { - Log::warn("UPNP_AddPortMapping(%s, %s, %s) failed with code %d (%s)", extPort.c_str(), inPort.c_str(), myIp.c_str(), r, strupnperror(r)); + Log::warn("UPNP_AddPortMapping(%s, %s, %s) failed with code %d (%s)", extPort.c_str(), inPort.c_str(), lanAddr, r, strupnperror(r)); return; } upnpData.back().portOpened = true; |