diff options
author | Robin Linden <dev@robinlinden.eu> | 2020-04-13 22:37:31 +0200 |
---|---|---|
committer | Robin Linden <dev@robinlinden.eu> | 2020-04-13 22:43:51 +0200 |
commit | 7f9f8045cd6f8d92559cdc9f7d297cf92e960e49 (patch) | |
tree | b933b84586350a6e070a6d8a135690d70e36ddef | |
parent | b816c6f8e3ced0f65f3f749e9e6ecb0edd313628 (diff) |
Fix things not being initialized if creating a TCP-only network
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | auto_tests/tcp_relay_test.c | 7 | ||||
-rw-r--r-- | toxcore/network.c | 4 |
3 files changed, 11 insertions, 3 deletions
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) | |||
425 | auto_test(set_name) | 425 | auto_test(set_name) |
426 | auto_test(set_status_message) | 426 | auto_test(set_status_message) |
427 | auto_test(skeleton) | 427 | auto_test(skeleton) |
428 | # TODO(iphydf): Fix this test and re-enable. | 428 | auto_test(tcp_relay) |
429 | #auto_test(tcp_relay) | ||
430 | auto_test(tox_many) | 429 | auto_test(tox_many) |
431 | auto_test(tox_many_tcp) | 430 | auto_test(tox_many_tcp) |
432 | auto_test(tox_one) | 431 | 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) | |||
24 | tox_options_free(opts); | 24 | tox_options_free(opts); |
25 | 25 | ||
26 | tox_bootstrap(tox_tcp, "tox.initramfs.io", 33445, key, nullptr); | 26 | tox_bootstrap(tox_tcp, "tox.initramfs.io", 33445, key, nullptr); |
27 | tox_add_tcp_relay(tox_tcp, "tox.initramfs.io", 33445, key, nullptr); | 27 | |
28 | Tox_Err_Bootstrap tcp_err; | ||
29 | tox_add_tcp_relay(tox_tcp, "tox.initramfs.io", 33445, key, &tcp_err); | ||
30 | ck_assert_msg(tcp_err == TOX_ERR_BOOTSTRAP_OK, | ||
31 | "attempting to add tcp relay returned with an error: %d", | ||
32 | tcp_err); | ||
28 | 33 | ||
29 | printf("Waiting for connection"); | 34 | printf("Waiting for connection"); |
30 | 35 | ||
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, | |||
956 | 956 | ||
957 | Networking_Core *new_networking_no_udp(const Logger *log) | 957 | Networking_Core *new_networking_no_udp(const Logger *log) |
958 | { | 958 | { |
959 | if (networking_at_startup() != 0) { | ||
960 | return nullptr; | ||
961 | } | ||
962 | |||
959 | /* this is the easiest way to completely disable UDP without changing too much code. */ | 963 | /* this is the easiest way to completely disable UDP without changing too much code. */ |
960 | Networking_Core *net = (Networking_Core *)calloc(1, sizeof(Networking_Core)); | 964 | Networking_Core *net = (Networking_Core *)calloc(1, sizeof(Networking_Core)); |
961 | 965 | ||