From 5b0fb9682bbbc8880f6cbd6ba97db3ca81aa291e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Wed, 21 Oct 2015 01:15:33 -0400
Subject: [PATCH] dhtrunner: return port in host byte order

---
 include/opendht/dhtrunner.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/opendht/dhtrunner.h b/include/opendht/dhtrunner.h
index 8a7b07e0..f37105eb 100644
--- a/include/opendht/dhtrunner.h
+++ b/include/opendht/dhtrunner.h
@@ -226,11 +226,11 @@ public:
     }
 
     /**
-     * Returns the currently bound port.
+     * Returns the currently bound port, in host byte order.
      * @param f: address family of the bound port to retreive.
      */
     in_port_t getBoundPort(sa_family_t f = AF_INET) const {
-        return ((sockaddr_in*)&getBound(f).first)->sin_port;
+        return ntohs(((sockaddr_in*)&getBound(f).first)->sin_port);
     }
 
     std::vector<NodeExport> exportNodes() const {
-- 
GitLab