diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fe6185b..95c36f5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,8 +425,7 @@ auto_test(send_message) auto_test(set_name) auto_test(set_status_message) auto_test(skeleton) -# TODO(iphydf): Fix this test and re-enable. -#auto_test(tcp_relay) +auto_test(tcp_relay) auto_test(tox_many) auto_test(tox_many_tcp) auto_test(tox_one) diff --git a/auto_tests/tcp_relay_test.c b/auto_tests/tcp_relay_test.c index b9eea92d..fcb1fdef 100644 --- a/auto_tests/tcp_relay_test.c +++ b/auto_tests/tcp_relay_test.c @@ -24,7 +24,12 @@ int main(void) tox_options_free(opts); tox_bootstrap(tox_tcp, "tox.initramfs.io", 33445, key, nullptr); - tox_add_tcp_relay(tox_tcp, "tox.initramfs.io", 33445, key, nullptr); + + Tox_Err_Bootstrap tcp_err; + tox_add_tcp_relay(tox_tcp, "tox.initramfs.io", 33445, key, &tcp_err); + ck_assert_msg(tcp_err == TOX_ERR_BOOTSTRAP_OK, + "attempting to add tcp relay returned with an error: %d", + tcp_err); printf("Waiting for connection"); diff --git a/toxcore/network.c b/toxcore/network.c index 3f297ad7..e5a58331 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -956,6 +956,10 @@ Networking_Core *new_networking_ex(const Logger *log, IP ip, uint16_t port_from, Networking_Core *new_networking_no_udp(const Logger *log) { + if (networking_at_startup() != 0) { + return nullptr; + } + /* this is the easiest way to completely disable UDP without changing too much code. */ Networking_Core *net = (Networking_Core *)calloc(1, sizeof(Networking_Core));