From 8aebc31a173fa3e6b80f25219b23131d9974a160 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sun, 15 Feb 2015 14:28:41 +0000 Subject: Fix unit test if there isn't a localhost address (for example FreeBSD jails), second part --- src/test.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/test.cpp b/src/test.cpp index ed92ad43a..43955b86f 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -1865,9 +1865,24 @@ struct TestConnection: public TestBase Handler hand_server("server"); Handler hand_client("client"); + Address address(0, 0, 0, 0, 30001); + Address bind_addr(0, 0, 0, 0, 30001); + /* + * Try to use the bind_address for servers with no localhost address + * For example: FreeBSD jails + */ + std::string bind_str = g_settings->get("bind_address"); + try { + bind_addr.Resolve(bind_str.c_str()); + + if (!bind_addr.isIPv6()) { + address = bind_addr; + } + } catch (ResolveError &e) { + } + infostream<<"** Creating server Connection"<