@@ -1865,9 +1865,24 @@ struct TestConnection: public TestBase
1865
1865
Handler hand_server (" server" );
1866
1866
Handler hand_client (" client" );
1867
1867
1868
+ Address address (0 , 0 , 0 , 0 , 30001 );
1869
+ Address bind_addr (0 , 0 , 0 , 0 , 30001 );
1870
+ /*
1871
+ * Try to use the bind_address for servers with no localhost address
1872
+ * For example: FreeBSD jails
1873
+ */
1874
+ std::string bind_str = g_settings->get (" bind_address" );
1875
+ try {
1876
+ bind_addr.Resolve (bind_str.c_str ());
1877
+
1878
+ if (!bind_addr.isIPv6 ()) {
1879
+ address = bind_addr;
1880
+ }
1881
+ } catch (ResolveError &e) {
1882
+ }
1883
+
1868
1884
infostream<<" ** Creating server Connection" <<std::endl;
1869
1885
con::Connection server (proto_id, 512 , 5.0 , false , &hand_server);
1870
- Address address (0 ,0 ,0 ,0 , 30001 );
1871
1886
server.Serve (address);
1872
1887
1873
1888
infostream<<" ** Creating client Connection" <<std::endl;
@@ -1878,7 +1893,11 @@ struct TestConnection: public TestBase
1878
1893
1879
1894
sleep_ms (50 );
1880
1895
1881
- Address server_address (127 ,0 ,0 ,1 , 30001 );
1896
+ Address server_address (127 , 0 , 0 , 1 , 30001 );
1897
+ if (address != Address (0 , 0 , 0 , 0 , 30001 )) {
1898
+ server_address = bind_addr;
1899
+ }
1900
+
1882
1901
infostream<<" ** running client.Connect()" <<std::endl;
1883
1902
client.Connect (server_address);
1884
1903
0 commit comments