From 6578d930f8b3d4961c33283d1ece981af5c41586 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Wed, 16 Apr 2014 07:19:40 -0400 Subject: [PATCH] DHT_bootstrap.c now has TCP server functionality enabled. Fixed a regression (same type as last commit). --- other/DHT_bootstrap.c | 2 ++ toxcore/onion_client.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index 50d473a9..738c2a0c 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c @@ -31,6 +31,8 @@ #include "../toxcore/friend_requests.h" #include "../toxcore/util.h" +#define TCP_RELAY_ENABLED + #ifdef TCP_RELAY_ENABLED #include "../toxcore/TCP_server.h" #endif diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 439a80c7..ca3ec560 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c @@ -660,11 +660,16 @@ static int send_fakeid_announce(Onion_Client *onion_c, uint16_t friend_num, uint memcpy(data + 1 + sizeof(uint64_t), onion_c->dht->self_public_key, crypto_box_PUBLICKEYBYTES); Node_format nodes[MAX_SENT_NODES]; uint16_t num_nodes = closelist_nodes(onion_c->dht, nodes, MAX_SENT_NODES); - int nodes_len = pack_nodes(data + FAKEID_DATA_MIN_LENGTH, FAKEID_DATA_MAX_LENGTH - FAKEID_DATA_MIN_LENGTH, nodes, + + int nodes_len = 0; + + if (num_nodes != 0) { + nodes_len = pack_nodes(data + FAKEID_DATA_MIN_LENGTH, FAKEID_DATA_MAX_LENGTH - FAKEID_DATA_MIN_LENGTH, nodes, num_nodes); - if (nodes_len <= 0) - return -1; + if (nodes_len <= 0) + return -1; + } int num1 = -1, num2 = -1;