summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Examples/NetworkTool')
-rw-r--r--Swiften/Examples/NetworkTool/main.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Swiften/Examples/NetworkTool/main.cpp b/Swiften/Examples/NetworkTool/main.cpp
index 00c12d2..77ba3f6 100644
--- a/Swiften/Examples/NetworkTool/main.cpp
+++ b/Swiften/Examples/NetworkTool/main.cpp
@@ -17,7 +17,7 @@
using namespace Swift;
-SimpleEventLoop eventLoop;
+static SimpleEventLoop eventLoop;
-void handleGetPublicIPRequestResponse(const boost::optional<HostAddress>& result) {
+static void handleGetPublicIPRequestResponse(const boost::optional<HostAddress>& result) {
if (result) {
std::cerr << "Result: " << result->toString() << std::endl;;
@@ -29,5 +29,5 @@ void handleGetPublicIPRequestResponse(const boost::optional<HostAddress>& result
}
-void handleGetForwardPortRequestResponse(const boost::optional<NATPortMapping>& result) {
+static void handleGetForwardPortRequestResponse(const boost::optional<NATPortMapping>& result) {
if (result) {
std::cerr << "Result: " << result->getPublicPort() << " -> " << result->getLocalPort() << std::endl;;
@@ -39,6 +39,6 @@ void handleGetForwardPortRequestResponse(const boost::optional<NATPortMapping>&
}
-void handleRemovePortForwardingRequestResponse(bool result) {
- if (result) {
+static void handleRemovePortForwardingRequestResponse(const boost::optional<bool> result) {
+ if (result && result.get()) {
std::cerr << "Result: OK" << std::endl;
}
@@ -59,5 +59,5 @@ int main(int argc, char* argv[]) {
boost::shared_ptr<NATTraversalGetPublicIPRequest> query = natTraverser.createGetPublicIPRequest();
query->onResult.connect(boost::bind(&handleGetPublicIPRequestResponse, _1));
- query->run();
+ query->start();
eventLoop.run();
}
@@ -68,5 +68,5 @@ int main(int argc, char* argv[]) {
boost::shared_ptr<NATTraversalForwardPortRequest> query = natTraverser.createForwardPortRequest(boost::lexical_cast<int>(argv[2]), boost::lexical_cast<int>(argv[3]));
query->onResult.connect(boost::bind(&handleGetForwardPortRequestResponse, _1));
- query->run();
+ query->start();
eventLoop.run();
}
@@ -77,5 +77,5 @@ int main(int argc, char* argv[]) {
boost::shared_ptr<NATTraversalRemovePortForwardingRequest> query = natTraverser.createRemovePortForwardingRequest(boost::lexical_cast<int>(argv[2]), boost::lexical_cast<int>(argv[3]));
query->onResult.connect(boost::bind(&handleRemovePortForwardingRequestResponse, _1));
- query->run();
+ query->start();
eventLoop.run();
}