Skip to content

Commit

Permalink
Fix things not being initialized if creating an TCP-only network
Browse files Browse the repository at this point in the history
  • Loading branch information
robinlinden committed Apr 13, 2020
1 parent b816c6f commit c1b77cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion auto_tests/tcp_relay_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(err == TOX_ERR_BOOTSTRAP_OK,
"attempting to add tcp relay returned with an error: %d",
tcp_err);

printf("Waiting for connection");

Expand Down
4 changes: 4 additions & 0 deletions toxcore/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit c1b77cc

Please sign in to comment.