Fix things not being initialized if creating a TCP-only network

This commit is contained in:
Robin Linden 2020-04-13 22:37:31 +02:00
parent b816c6f8e3
commit 7f9f8045cd
No known key found for this signature in database
GPG Key ID: 601A604B7E605776
3 changed files with 11 additions and 3 deletions

View File

@ -425,8 +425,7 @@ auto_test(send_message)
auto_test(set_name) auto_test(set_name)
auto_test(set_status_message) auto_test(set_status_message)
auto_test(skeleton) 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)
auto_test(tox_many_tcp) auto_test(tox_many_tcp)
auto_test(tox_one) auto_test(tox_one)

View File

@ -24,7 +24,12 @@ int main(void)
tox_options_free(opts); tox_options_free(opts);
tox_bootstrap(tox_tcp, "tox.initramfs.io", 33445, key, nullptr); 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"); printf("Waiting for connection");

View File

@ -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) 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. */ /* this is the easiest way to completely disable UDP without changing too much code. */
Networking_Core *net = (Networking_Core *)calloc(1, sizeof(Networking_Core)); Networking_Core *net = (Networking_Core *)calloc(1, sizeof(Networking_Core));