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>
This commit is contained in:
Sébastien Blin
2018-05-09 11:15:54 -04:00
committed by Philippe Gorley
parent 9c44d59fa0
commit e34f3ca7bc

View File

@ -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());