summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-12-30 21:35:54 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-12-30 21:35:54 (GMT)
commit69d5515110bba3803ef37dd470d690b7b8aac9ae (patch)
tree5df975c0cbd285a03472c11c55338325631ce838 /Swiften/Network
parentf5f7dcf14732d6075b89a5638f9d72f10b8d35c9 (diff)
downloadswift-69d5515110bba3803ef37dd470d690b7b8aac9ae.zip
swift-69d5515110bba3803ef37dd470d690b7b8aac9ae.tar.bz2
Fixed wrong usage of NAT-PMP API.
Passing arguments in the correct order now. Change-Id: Id8bf9fc2662b0bcbd2f100f1f2c7a8928d3f95e4
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/NATPMPInterface.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp
index e178ab4..15508b5 100644
--- a/Swiften/Network/NATPMPInterface.cpp
+++ b/Swiften/Network/NATPMPInterface.cpp
@@ -64,9 +64,14 @@ boost::optional<HostAddress> NATPMPInterface::getPublicIP() {
boost::optional<NATPortMapping> NATPMPInterface::addPortForward(int localPort, int publicPort) {
NATPortMapping mapping(localPort, publicPort, NATPortMapping::TCP);
- if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, boost::numeric_cast<uint16_t>(mapping.getLeaseInSeconds()), boost::numeric_cast<uint16_t>(mapping.getPublicPort()), mapping.getLocalPort()) < 0) {
- SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!" << std::endl;
- return boost::optional<NATPortMapping>();
+ if (sendnewportmappingrequest(
+ &p->natpmp,
+ mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP,
+ boost::numeric_cast<uint16_t>(mapping.getLocalPort()),
+ boost::numeric_cast<uint16_t>(mapping.getPublicPort()),
+ mapping.getLeaseInSeconds()) < 0) {
+ SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!" << std::endl;
+ return boost::optional<NATPortMapping>();
}
int r = 0;