diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c index 2f244693..cd060b1f 100644 --- a/auto_tests/onion_test.c +++ b/auto_tests/onion_test.c @@ -186,6 +186,7 @@ START_TEST(test_basic) while (handled_test_3 == 0) { do_onion(onion1); do_onion(onion2); + c_sleep(50); } randombytes(sb_data, sizeof(sb_data)); diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c index a1e5495e..7a60a235 100644 --- a/toxcore/onion_announce.c +++ b/toxcore/onion_announce.c @@ -268,10 +268,14 @@ static int handle_announce_request(void *object, IP_Port source, uint8_t *packet } } - int nodes_length = pack_nodes(pl + 1 + ONION_PING_ID_SIZE, sizeof(nodes_list), nodes_list, num_nodes); + int nodes_length = 0; - if (nodes_length <= 0) - return 1; + if (num_nodes != 0) { + nodes_length = pack_nodes(pl + 1 + ONION_PING_ID_SIZE, sizeof(nodes_list), nodes_list, num_nodes); + + if (nodes_length <= 0) + return 1; + } uint8_t data[ONION_ANNOUNCE_RESPONSE_MAX_SIZE]; len = encrypt_data_fast(shared_key, nonce, pl, 1 + ONION_PING_ID_SIZE + nodes_length,