From e34f3ca7bc1b4b8cd28f39c897d197602b4ece93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Wed, 9 May 2018 11:15:54 -0400
Subject: [PATCH] tests: fix test_TURN

permitPeer was failing because of a bad parsing.
Here we should use the ipv4 mapped address.

Change-Id: If286afc54efc99f8828c6379a6264c9da4285d75
Reviewed-by: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
---
 test/turn/test_TURN.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/test/turn/test_TURN.cpp b/test/turn/test_TURN.cpp
index 7286632bea..f80c3a5358 100644
--- a/test/turn/test_TURN.cpp
+++ b/test/turn/test_TURN.cpp
@@ -20,11 +20,12 @@
 #include "test_TURN.h"
 #include "turn_transport.h"
 
+#include <chrono>
+#include <opendht/sockaddr.h>
+#include <stdexcept>
 #include <sys/socket.h>
 #include <sys/unistd.h>
-#include <stdexcept>
 #include <thread>
-#include <chrono>
 #include <vector>
 
 using namespace ring;
@@ -99,7 +100,8 @@ test_TURN::testSimpleConnection()
     TCPSocket sock = {param.server.getFamily()};
 
     // Permit myself
-    turn.permitPeer(turn.mappedAddr());
+    auto mapped = static_cast<dht::SockAddr>(turn.mappedAddr());
+    turn.permitPeer(IpAddr { mapped.getMappedIPv4().toString() });
     std::this_thread::sleep_for(std::chrono::seconds(2));
 
     sock.connect(turn.peerRelayAddr());
-- 
GitLab