summaryrefslogtreecommitdiff
path: root/toxcore/DHT.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-05 10:31:29 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-05 23:09:28 +0000
commit8739f7fccb7cafc54ca0f5fa074c9a740f7048ba (patch)
tree88e9f53fa6e734cd8095487d1896c56f844c782c /toxcore/DHT.c
parent64d0297acc7d6a1697683052e15cc76383312c38 (diff)
Make tox.c unambiguously parseable.
Rules: 1. Constants are uppercase names: THE_CONSTANT. 2. SUE[1] types start with an uppercase letter and have at least one lowercase letter in it: The_Type, THE_Type. 3. Function types end in "_cb": tox_friend_connection_cb. 4. Variable and function names are all lowercase: the_function. This makes it easier for humans reading the code to determine what an identifier means. I'm not convinced by the enum type name change, but I don't know a better rule. Currently, a lot of enum types are spelled like constants, which is confusing. [1] struct/union/enum
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r--toxcore/DHT.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index bb996e2d..6c104a73 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -283,7 +283,7 @@ void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, const uint8_t
283/* Copy shared_key to encrypt/decrypt DHT packet from public_key into shared_key 283/* Copy shared_key to encrypt/decrypt DHT packet from public_key into shared_key
284 * for packets that we receive. 284 * for packets that we receive.
285 */ 285 */
286void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, const uint8_t *public_key) 286void dht_get_shared_key_recv(DHT *dht, uint8_t *shared_key, const uint8_t *public_key)
287{ 287{
288 get_shared_key(&dht->shared_keys_recv, shared_key, dht->self_secret_key, public_key); 288 get_shared_key(&dht->shared_keys_recv, shared_key, dht->self_secret_key, public_key);
289} 289}
@@ -291,7 +291,7 @@ void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, const uint8_t *publi
291/* Copy shared_key to encrypt/decrypt DHT packet from public_key into shared_key 291/* Copy shared_key to encrypt/decrypt DHT packet from public_key into shared_key
292 * for packets that we send. 292 * for packets that we send.
293 */ 293 */
294void DHT_get_shared_key_sent(DHT *dht, uint8_t *shared_key, const uint8_t *public_key) 294void dht_get_shared_key_sent(DHT *dht, uint8_t *shared_key, const uint8_t *public_key)
295{ 295{
296 get_shared_key(&dht->shared_keys_sent, shared_key, dht->self_secret_key, public_key); 296 get_shared_key(&dht->shared_keys_sent, shared_key, dht->self_secret_key, public_key);
297} 297}
@@ -455,7 +455,7 @@ int pack_ip_port(uint8_t *data, uint16_t length, const IP_Port *ip_port)
455 } 455 }
456} 456}
457 457
458static int DHT_create_packet(const uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE], 458static int dht_create_packet(const uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE],
459 const uint8_t *shared_key, const uint8_t type, uint8_t *plain, size_t plain_length, uint8_t *packet) 459 const uint8_t *shared_key, const uint8_t type, uint8_t *plain, size_t plain_length, uint8_t *packet)
460{ 460{
461 VLA(uint8_t, encrypted, plain_length + CRYPTO_MAC_SIZE); 461 VLA(uint8_t, encrypted, plain_length + CRYPTO_MAC_SIZE);
@@ -1315,9 +1315,9 @@ static int getnodes(DHT *dht, IP_Port ip_port, const uint8_t *public_key, const
1315 memcpy(plain + CRYPTO_PUBLIC_KEY_SIZE, &ping_id, sizeof(ping_id)); 1315 memcpy(plain + CRYPTO_PUBLIC_KEY_SIZE, &ping_id, sizeof(ping_id));
1316 1316
1317 uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE]; 1317 uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE];
1318 DHT_get_shared_key_sent(dht, shared_key, public_key); 1318 dht_get_shared_key_sent(dht, shared_key, public_key);
1319 1319
1320 const int len = DHT_create_packet(dht->self_public_key, shared_key, NET_PACKET_GET_NODES, 1320 const int len = dht_create_packet(dht->self_public_key, shared_key, NET_PACKET_GET_NODES,
1321 plain, sizeof(plain), data); 1321 plain, sizeof(plain), data);
1322 1322
1323 if (len != sizeof(data)) { 1323 if (len != sizeof(data)) {
@@ -1364,7 +1364,7 @@ static int sendnodes_ipv6(const DHT *dht, IP_Port ip_port, const uint8_t *public
1364 const uint32_t crypto_size = 1 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE + CRYPTO_MAC_SIZE; 1364 const uint32_t crypto_size = 1 + CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE + CRYPTO_MAC_SIZE;
1365 VLA(uint8_t, data, 1 + nodes_length + length + crypto_size); 1365 VLA(uint8_t, data, 1 + nodes_length + length + crypto_size);
1366 1366
1367 const int len = DHT_create_packet(dht->self_public_key, shared_encryption_key, NET_PACKET_SEND_NODES_IPV6, 1367 const int len = dht_create_packet(dht->self_public_key, shared_encryption_key, NET_PACKET_SEND_NODES_IPV6,
1368 plain, 1 + nodes_length + length, data); 1368 plain, 1 + nodes_length + length, data);
1369 1369
1370 if (len != SIZEOF_VLA(data)) { 1370 if (len != SIZEOF_VLA(data)) {
@@ -1392,7 +1392,7 @@ static int handle_getnodes(void *object, IP_Port source, const uint8_t *packet,
1392 uint8_t plain[CRYPTO_NODE_SIZE]; 1392 uint8_t plain[CRYPTO_NODE_SIZE];
1393 uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE]; 1393 uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE];
1394 1394
1395 DHT_get_shared_key_recv(dht, shared_key, packet + 1); 1395 dht_get_shared_key_recv(dht, shared_key, packet + 1);
1396 const int len = decrypt_data_symmetric( 1396 const int len = decrypt_data_symmetric(
1397 shared_key, 1397 shared_key,
1398 packet + 1 + CRYPTO_PUBLIC_KEY_SIZE, 1398 packet + 1 + CRYPTO_PUBLIC_KEY_SIZE,
@@ -1462,7 +1462,7 @@ static int handle_sendnodes_core(void *object, IP_Port source, const uint8_t *pa
1462 1462
1463 VLA(uint8_t, plain, 1 + data_size + sizeof(uint64_t)); 1463 VLA(uint8_t, plain, 1 + data_size + sizeof(uint64_t));
1464 uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE]; 1464 uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE];
1465 DHT_get_shared_key_sent(dht, shared_key, packet + 1); 1465 dht_get_shared_key_sent(dht, shared_key, packet + 1);
1466 const int len = decrypt_data_symmetric( 1466 const int len = decrypt_data_symmetric(
1467 shared_key, 1467 shared_key,
1468 packet + 1 + CRYPTO_PUBLIC_KEY_SIZE, 1468 packet + 1 + CRYPTO_PUBLIC_KEY_SIZE,
@@ -1538,7 +1538,7 @@ static int handle_sendnodes_ipv6(void *object, IP_Port source, const uint8_t *pa
1538/*----------------------------------------------------------------------------------*/ 1538/*----------------------------------------------------------------------------------*/
1539/*------------------------END of packet handling functions--------------------------*/ 1539/*------------------------END of packet handling functions--------------------------*/
1540 1540
1541int DHT_addfriend(DHT *dht, const uint8_t *public_key, void (*ip_callback)(void *data, int32_t number, IP_Port), 1541int dht_addfriend(DHT *dht, const uint8_t *public_key, void (*ip_callback)(void *data, int32_t number, IP_Port),
1542 void *data, int32_t number, uint16_t *lock_count) 1542 void *data, int32_t number, uint16_t *lock_count)
1543{ 1543{
1544 const uint32_t friend_num = index_of_friend_pk(dht->friends_list, dht->num_friends, public_key); 1544 const uint32_t friend_num = index_of_friend_pk(dht->friends_list, dht->num_friends, public_key);
@@ -1595,7 +1595,7 @@ int DHT_addfriend(DHT *dht, const uint8_t *public_key, void (*ip_callback)(void
1595 return 0; 1595 return 0;
1596} 1596}
1597 1597
1598int DHT_delfriend(DHT *dht, const uint8_t *public_key, uint16_t lock_count) 1598int dht_delfriend(DHT *dht, const uint8_t *public_key, uint16_t lock_count)
1599{ 1599{
1600 const uint32_t friend_num = index_of_friend_pk(dht->friends_list, dht->num_friends, public_key); 1600 const uint32_t friend_num = index_of_friend_pk(dht->friends_list, dht->num_friends, public_key);
1601 1601
@@ -1639,7 +1639,7 @@ int DHT_delfriend(DHT *dht, const uint8_t *public_key, uint16_t lock_count)
1639} 1639}
1640 1640
1641/* TODO(irungentoo): Optimize this. */ 1641/* TODO(irungentoo): Optimize this. */
1642int DHT_getfriendip(const DHT *dht, const uint8_t *public_key, IP_Port *ip_port) 1642int dht_getfriendip(const DHT *dht, const uint8_t *public_key, IP_Port *ip_port)
1643{ 1643{
1644 ip_reset(&ip_port->ip); 1644 ip_reset(&ip_port->ip);
1645 ip_port->port = 0; 1645 ip_port->port = 0;
@@ -1743,7 +1743,7 @@ static uint8_t do_ping_and_sendnode_requests(DHT *dht, uint64_t *lastgetnode, co
1743/* Ping each client in the "friends" list every PING_INTERVAL seconds. Send a get nodes request 1743/* Ping each client in the "friends" list every PING_INTERVAL seconds. Send a get nodes request
1744 * every GET_NODE_INTERVAL seconds to a random good node for each "friend" in our "friends" list. 1744 * every GET_NODE_INTERVAL seconds to a random good node for each "friend" in our "friends" list.
1745 */ 1745 */
1746static void do_DHT_friends(DHT *dht) 1746static void do_dht_friends(DHT *dht)
1747{ 1747{
1748 for (size_t i = 0; i < dht->num_friends; ++i) { 1748 for (size_t i = 0; i < dht->num_friends; ++i) {
1749 DHT_Friend *const dht_friend = &dht->friends_list[i]; 1749 DHT_Friend *const dht_friend = &dht->friends_list[i];
@@ -1803,16 +1803,16 @@ static void do_Close(DHT *dht)
1803 } 1803 }
1804} 1804}
1805 1805
1806void DHT_getnodes(DHT *dht, const IP_Port *from_ipp, const uint8_t *from_id, const uint8_t *which_id) 1806void dht_getnodes(DHT *dht, const IP_Port *from_ipp, const uint8_t *from_id, const uint8_t *which_id)
1807{ 1807{
1808 getnodes(dht, *from_ipp, from_id, which_id, nullptr); 1808 getnodes(dht, *from_ipp, from_id, which_id, nullptr);
1809} 1809}
1810 1810
1811void DHT_bootstrap(DHT *dht, IP_Port ip_port, const uint8_t *public_key) 1811void dht_bootstrap(DHT *dht, IP_Port ip_port, const uint8_t *public_key)
1812{ 1812{
1813 getnodes(dht, ip_port, public_key, dht->self_public_key, nullptr); 1813 getnodes(dht, ip_port, public_key, dht->self_public_key, nullptr);
1814} 1814}
1815int DHT_bootstrap_from_address(DHT *dht, const char *address, uint8_t ipv6enabled, 1815int dht_bootstrap_from_address(DHT *dht, const char *address, uint8_t ipv6enabled,
1816 uint16_t port, const uint8_t *public_key) 1816 uint16_t port, const uint8_t *public_key)
1817{ 1817{
1818 IP_Port ip_port_v64; 1818 IP_Port ip_port_v64;
@@ -1829,11 +1829,11 @@ int DHT_bootstrap_from_address(DHT *dht, const char *address, uint8_t ipv6enable
1829 1829
1830 if (addr_resolve_or_parse_ip(address, &ip_port_v64.ip, ip_extra)) { 1830 if (addr_resolve_or_parse_ip(address, &ip_port_v64.ip, ip_extra)) {
1831 ip_port_v64.port = port; 1831 ip_port_v64.port = port;
1832 DHT_bootstrap(dht, ip_port_v64, public_key); 1832 dht_bootstrap(dht, ip_port_v64, public_key);
1833 1833
1834 if ((ip_extra != nullptr) && ip_isset(ip_extra)) { 1834 if ((ip_extra != nullptr) && ip_isset(ip_extra)) {
1835 ip_port_v4.port = port; 1835 ip_port_v4.port = port;
1836 DHT_bootstrap(dht, ip_port_v4, public_key); 1836 dht_bootstrap(dht, ip_port_v4, public_key);
1837 } 1837 }
1838 1838
1839 return 1; 1839 return 1;
@@ -2673,7 +2673,7 @@ static int cryptopacket_handle(void *object, IP_Port source, const uint8_t *pack
2673 2673
2674/*----------------------------------------------------------------------------------*/ 2674/*----------------------------------------------------------------------------------*/
2675 2675
2676DHT *new_DHT(const Logger *log, Networking_Core *net, bool holepunching_enabled) 2676DHT *new_dht(const Logger *log, Networking_Core *net, bool holepunching_enabled)
2677{ 2677{
2678 /* init time */ 2678 /* init time */
2679 unix_time_update(); 2679 unix_time_update();
@@ -2696,7 +2696,7 @@ DHT *new_DHT(const Logger *log, Networking_Core *net, bool holepunching_enabled)
2696 dht->ping = ping_new(dht); 2696 dht->ping = ping_new(dht);
2697 2697
2698 if (dht->ping == nullptr) { 2698 if (dht->ping == nullptr) {
2699 kill_DHT(dht); 2699 kill_dht(dht);
2700 return nullptr; 2700 return nullptr;
2701 } 2701 }
2702 2702
@@ -2715,8 +2715,8 @@ DHT *new_DHT(const Logger *log, Networking_Core *net, bool holepunching_enabled)
2715 uint8_t random_key_bytes[CRYPTO_PUBLIC_KEY_SIZE]; 2715 uint8_t random_key_bytes[CRYPTO_PUBLIC_KEY_SIZE];
2716 random_bytes(random_key_bytes, sizeof(random_key_bytes)); 2716 random_bytes(random_key_bytes, sizeof(random_key_bytes));
2717 2717
2718 if (DHT_addfriend(dht, random_key_bytes, nullptr, nullptr, 0, nullptr) != 0) { 2718 if (dht_addfriend(dht, random_key_bytes, nullptr, nullptr, 0, nullptr) != 0) {
2719 kill_DHT(dht); 2719 kill_dht(dht);
2720 return nullptr; 2720 return nullptr;
2721 } 2721 }
2722 } 2722 }
@@ -2724,7 +2724,7 @@ DHT *new_DHT(const Logger *log, Networking_Core *net, bool holepunching_enabled)
2724 return dht; 2724 return dht;
2725} 2725}
2726 2726
2727void do_DHT(DHT *dht) 2727void do_dht(DHT *dht)
2728{ 2728{
2729 unix_time_update(); 2729 unix_time_update();
2730 2730
@@ -2732,13 +2732,13 @@ void do_DHT(DHT *dht)
2732 return; 2732 return;
2733 } 2733 }
2734 2734
2735 // Load friends/clients if first call to do_DHT 2735 // Load friends/clients if first call to do_dht
2736 if (dht->loaded_num_nodes) { 2736 if (dht->loaded_num_nodes) {
2737 DHT_connect_after_load(dht); 2737 dht_connect_after_load(dht);
2738 } 2738 }
2739 2739
2740 do_Close(dht); 2740 do_Close(dht);
2741 do_DHT_friends(dht); 2741 do_dht_friends(dht);
2742 do_NAT(dht); 2742 do_NAT(dht);
2743 ping_iterate(dht->ping); 2743 ping_iterate(dht->ping);
2744#if DHT_HARDENING 2744#if DHT_HARDENING
@@ -2747,7 +2747,7 @@ void do_DHT(DHT *dht)
2747 dht->last_run = unix_time(); 2747 dht->last_run = unix_time();
2748} 2748}
2749 2749
2750void kill_DHT(DHT *dht) 2750void kill_dht(DHT *dht)
2751{ 2751{
2752 networking_registerhandler(dht->net, NET_PACKET_GET_NODES, nullptr, nullptr); 2752 networking_registerhandler(dht->net, NET_PACKET_GET_NODES, nullptr, nullptr);
2753 networking_registerhandler(dht->net, NET_PACKET_SEND_NODES_IPV6, nullptr, nullptr); 2753 networking_registerhandler(dht->net, NET_PACKET_SEND_NODES_IPV6, nullptr, nullptr);
@@ -2771,7 +2771,7 @@ void kill_DHT(DHT *dht)
2771#define MAX_SAVED_DHT_NODES (((DHT_FAKE_FRIEND_NUMBER * MAX_FRIEND_CLIENTS) + LCLIENT_LIST) * 2) 2771#define MAX_SAVED_DHT_NODES (((DHT_FAKE_FRIEND_NUMBER * MAX_FRIEND_CLIENTS) + LCLIENT_LIST) * 2)
2772 2772
2773/* Get the size of the DHT (for saving). */ 2773/* Get the size of the DHT (for saving). */
2774uint32_t DHT_size(const DHT *dht) 2774uint32_t dht_size(const DHT *dht)
2775{ 2775{
2776 uint32_t numv4 = 0; 2776 uint32_t numv4 = 0;
2777 uint32_t numv6 = 0; 2777 uint32_t numv6 = 0;
@@ -2796,7 +2796,7 @@ uint32_t DHT_size(const DHT *dht)
2796 return size32 + sizesubhead + packed_node_size(net_family_ipv4) * numv4 + packed_node_size(net_family_ipv6) * numv6; 2796 return size32 + sizesubhead + packed_node_size(net_family_ipv4) * numv4 + packed_node_size(net_family_ipv6) * numv6;
2797} 2797}
2798 2798
2799static uint8_t *DHT_save_subheader(uint8_t *data, uint32_t len, uint16_t type) 2799static uint8_t *dht_save_subheader(uint8_t *data, uint32_t len, uint16_t type)
2800{ 2800{
2801 host_to_lendian32(data, len); 2801 host_to_lendian32(data, len);
2802 data += sizeof(uint32_t); 2802 data += sizeof(uint32_t);
@@ -2806,8 +2806,8 @@ static uint8_t *DHT_save_subheader(uint8_t *data, uint32_t len, uint16_t type)
2806} 2806}
2807 2807
2808 2808
2809/* Save the DHT in data where data is an array of size DHT_size(). */ 2809/* Save the DHT in data where data is an array of size dht_size(). */
2810void DHT_save(const DHT *dht, uint8_t *data) 2810void dht_save(const DHT *dht, uint8_t *data)
2811{ 2811{
2812 host_to_lendian32(data, DHT_STATE_COOKIE_GLOBAL); 2812 host_to_lendian32(data, DHT_STATE_COOKIE_GLOBAL);
2813 data += sizeof(uint32_t); 2813 data += sizeof(uint32_t);
@@ -2815,7 +2815,7 @@ void DHT_save(const DHT *dht, uint8_t *data)
2815 uint8_t *const old_data = data; 2815 uint8_t *const old_data = data;
2816 2816
2817 /* get right offset. we write the actual header later. */ 2817 /* get right offset. we write the actual header later. */
2818 data = DHT_save_subheader(data, 0, 0); 2818 data = dht_save_subheader(data, 0, 0);
2819 2819
2820 Node_format clients[MAX_SAVED_DHT_NODES]; 2820 Node_format clients[MAX_SAVED_DHT_NODES];
2821 2821
@@ -2853,14 +2853,14 @@ void DHT_save(const DHT *dht, uint8_t *data)
2853 } 2853 }
2854 } 2854 }
2855 2855
2856 DHT_save_subheader(old_data, pack_nodes(data, sizeof(Node_format) * num, clients, num), DHT_STATE_TYPE_NODES); 2856 dht_save_subheader(old_data, pack_nodes(data, sizeof(Node_format) * num, clients, num), DHT_STATE_TYPE_NODES);
2857} 2857}
2858 2858
2859/* Bootstrap from this number of nodes every time DHT_connect_after_load() is called */ 2859/* Bootstrap from this number of nodes every time dht_connect_after_load() is called */
2860#define SAVE_BOOTSTAP_FREQUENCY 8 2860#define SAVE_BOOTSTAP_FREQUENCY 8
2861 2861
2862/* Start sending packets after DHT loaded_friends_list and loaded_clients_list are set */ 2862/* Start sending packets after DHT loaded_friends_list and loaded_clients_list are set */
2863int DHT_connect_after_load(DHT *dht) 2863int dht_connect_after_load(DHT *dht)
2864{ 2864{
2865 if (dht == nullptr) { 2865 if (dht == nullptr) {
2866 return -1; 2866 return -1;
@@ -2871,7 +2871,7 @@ int DHT_connect_after_load(DHT *dht)
2871 } 2871 }
2872 2872
2873 /* DHT is connected, stop. */ 2873 /* DHT is connected, stop. */
2874 if (DHT_non_lan_connected(dht)) { 2874 if (dht_non_lan_connected(dht)) {
2875 free(dht->loaded_nodes_list); 2875 free(dht->loaded_nodes_list);
2876 dht->loaded_nodes_list = nullptr; 2876 dht->loaded_nodes_list = nullptr;
2877 dht->loaded_num_nodes = 0; 2877 dht->loaded_num_nodes = 0;
@@ -2880,7 +2880,7 @@ int DHT_connect_after_load(DHT *dht)
2880 2880
2881 for (uint32_t i = 0; i < dht->loaded_num_nodes && i < SAVE_BOOTSTAP_FREQUENCY; ++i) { 2881 for (uint32_t i = 0; i < dht->loaded_num_nodes && i < SAVE_BOOTSTAP_FREQUENCY; ++i) {
2882 const unsigned int index = dht->loaded_nodes_index % dht->loaded_num_nodes; 2882 const unsigned int index = dht->loaded_nodes_index % dht->loaded_num_nodes;
2883 DHT_bootstrap(dht, dht->loaded_nodes_list[index].ip_port, dht->loaded_nodes_list[index].public_key); 2883 dht_bootstrap(dht, dht->loaded_nodes_list[index].ip_port, dht->loaded_nodes_list[index].public_key);
2884 ++dht->loaded_nodes_index; 2884 ++dht->loaded_nodes_index;
2885 } 2885 }
2886 2886
@@ -2926,7 +2926,7 @@ static int dht_load_state_callback(void *outer, const uint8_t *data, uint32_t le
2926 * return -1 if failure. 2926 * return -1 if failure.
2927 * return 0 if success. 2927 * return 0 if success.
2928 */ 2928 */
2929int DHT_load(DHT *dht, const uint8_t *data, uint32_t length) 2929int dht_load(DHT *dht, const uint8_t *data, uint32_t length)
2930{ 2930{
2931 const uint32_t cookie_len = sizeof(uint32_t); 2931 const uint32_t cookie_len = sizeof(uint32_t);
2932 2932
@@ -2946,7 +2946,7 @@ int DHT_load(DHT *dht, const uint8_t *data, uint32_t length)
2946/* return false if we are not connected to the DHT. 2946/* return false if we are not connected to the DHT.
2947 * return true if we are. 2947 * return true if we are.
2948 */ 2948 */
2949bool DHT_isconnected(const DHT *dht) 2949bool dht_isconnected(const DHT *dht)
2950{ 2950{
2951 unix_time_update(); 2951 unix_time_update();
2952 2952
@@ -2965,7 +2965,7 @@ bool DHT_isconnected(const DHT *dht)
2965/* return false if we are not connected or only connected to lan peers with the DHT. 2965/* return false if we are not connected or only connected to lan peers with the DHT.
2966 * return true if we are. 2966 * return true if we are.
2967 */ 2967 */
2968bool DHT_non_lan_connected(const DHT *dht) 2968bool dht_non_lan_connected(const DHT *dht)
2969{ 2969{
2970 unix_time_update(); 2970 unix_time_update();
2971 2971