toxcore/toxcore
jfreegman af5dd43c98
Refactor onion_client.c do_friends()
This commit simplifies the logic determining how often we
send announce request packets to offline peers and how often
we attempt to re-populate our nodes lists. It also removes
some randomness from packet sending that was intended to
reduce network traffic but greatly increased the code complexity
and didn't really do all that much to help.

We now aggressively search the DHT for offline friends when we first
bootstrap, add a new friend, or when a friend goes offline, for a
short duration until we've sent a certain number of successful
lookup requests. Thereafter, we send one lookup request every 3
minutes for each node associated with the friend (typically
between 4 and 8), for each friend.

We also no longer spam node requests whenever our list of living
nodes drops below the maximum. Instead, we repopulate the nodes
list only when it drops to or below half the maximum, or after
a 10 minute timeout.

The effects of these changes is a decrease in overall tox network
traffic by about 30-40% with UDP enabled, and a bit less than
that with UDP disabled. The network may also be more reliable
overall because everything is significantly more deterministic
and less random
2022-03-03 10:40:22 -05:00
..
events cleanup: Enable most cppcheck warnings as errors. 2022-02-21 17:17:36 +00:00
attributes.h chore: Disable non-null attributes by default. 2022-02-10 21:33:51 +00:00
bin_pack.c Add wrapper library for msgpack pack functions 2022-02-11 22:11:32 -05:00
bin_pack.h Add wrapper library for msgpack pack functions 2022-02-11 22:11:32 -05:00
bin_unpack.c Split tox_unpack into two smaller libs 2022-02-10 15:34:35 -05:00
bin_unpack.h cleanup: Enable most cppcheck warnings as errors. 2022-02-21 17:17:36 +00:00
BUILD.bazel test: Add test coverage docker build for local tests. 2022-02-24 16:24:28 +00:00
ccompat.c feat: Add async event handling (callbacks) code. 2022-02-06 17:28:28 +00:00
ccompat.h chore: Enable a bunch more warnings in GCC builds. 2022-02-28 23:26:35 +00:00
crypto_core_test.cc chore: Add a .clang-format that mostly agrees with astyle. 2022-02-21 16:16:16 +00:00
crypto_core.c cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
crypto_core.h cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
DHT_test.cc chore: Add a .clang-format that mostly agrees with astyle. 2022-02-21 16:16:16 +00:00
DHT.c cleanup: Remove *all* boolean-int conversions. 2022-02-27 00:29:43 +00:00
DHT.h test: Add test coverage docker build for local tests. 2022-02-24 16:24:28 +00:00
friend_connection_test.cc chore: Add a .clang-format that mostly agrees with astyle. 2022-02-21 16:16:16 +00:00
friend_connection.c cleanup: Remove *all* boolean-int conversions. 2022-02-27 00:29:43 +00:00
friend_connection.h cleanup: Remove more implicit bool conversions. 2022-02-23 22:00:46 +00:00
friend_requests.c cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
friend_requests.h cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
group.c cleanup: Remove *all* boolean-int conversions. 2022-02-27 00:29:43 +00:00
group.h cleanup: Remove *all* boolean-int conversions. 2022-02-27 00:29:43 +00:00
LAN_discovery.c cleanup: Remove port from Broadcast_Info. 2022-03-03 15:21:34 +00:00
LAN_discovery.h cleanup: Enable most cppcheck warnings as errors. 2022-02-21 17:17:36 +00:00
list_test.cc chore: Add a .clang-format that mostly agrees with astyle. 2022-02-21 16:16:16 +00:00
list.c cleanup: Remove *all* boolean-int conversions. 2022-02-27 00:29:43 +00:00
list.h cleanup: Remove *all* boolean-int conversions. 2022-02-27 00:29:43 +00:00
logger.c cleanup: Reduce name shadowing; remove ptr-to-bool conversions. 2022-02-23 17:30:53 +00:00
logger.h chore: Add a .clang-format that mostly agrees with astyle. 2022-02-21 16:16:16 +00:00
Makefile.inc Add wrapper library for msgpack pack functions 2022-02-11 22:11:32 -05:00
Messenger.c cleanup: Don't reference local variables in macro bodies. 2022-03-03 00:45:34 +00:00
Messenger.h cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
mono_time_test.cc test: Add test coverage docker build for local tests. 2022-02-24 16:24:28 +00:00
mono_time.c cleanup: Mark all local non-pointers as const where possible. 2022-02-23 19:30:01 +00:00
mono_time.h cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
net_crypto.c cleanup: Don't reference local variables in macro bodies. 2022-03-03 00:45:34 +00:00
net_crypto.h cleanup: Remove more implicit bool conversions. 2022-02-23 22:00:46 +00:00
network_test.cc cleanup: Remove any disallowed casts. 2022-02-22 02:19:29 +00:00
network.c cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
network.h cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
onion_announce.c cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
onion_announce.h cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
onion_client.c Refactor onion_client.c do_friends() 2022-03-03 10:40:22 -05:00
onion_client.h fix: Report failure to DHT bootstrap back to the client. 2022-02-24 11:37:47 +00:00
onion.c cleanup: Log at ERROR level when connect() fails. 2022-02-28 14:01:01 +00:00
onion.h cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
ping_array_test.cc test: Add mallocfail and proxy test to our coverage runs. 2022-02-25 01:55:28 +00:00
ping_array.c cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
ping_array.h cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
ping.c cleanup: Remove *all* boolean-int conversions. 2022-02-27 00:29:43 +00:00
ping.h cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
state.c cleanup: Remove extra parens around function arguments. 2022-01-12 07:02:29 +00:00
state.h cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
TCP_client.c cleanup: Log at ERROR level when connect() fails. 2022-02-28 14:01:01 +00:00
TCP_client.h cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
TCP_common.c cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
TCP_common.h cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
TCP_connection_test.cc merge tcp_connection changes from new groupchats fork 2021-12-14 16:57:28 -05:00
TCP_connection.c cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
TCP_connection.h cleanup: Comply with strict include ordering. 2022-02-25 16:44:35 +00:00
TCP_server.c cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
TCP_server.h cleanup: Remove more implicit bool conversions. 2022-02-23 22:00:46 +00:00
tox_api.c cleanup: Comply with strict include ordering. 2022-02-25 16:44:35 +00:00
tox_dispatch.c cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
tox_dispatch.h feat: Add async event handling (callbacks) code. 2022-02-06 17:28:28 +00:00
tox_events.c perf: Reduce minimal encoding size of packed events. 2022-02-12 17:44:44 +00:00
tox_events.h cleanup: Enable most cppcheck warnings as errors. 2022-02-21 17:17:36 +00:00
tox_private.h Add DHT queries to private API 2022-02-10 10:33:31 -05:00
tox_test.cc cleanup: Remove port from Broadcast_Info. 2022-03-03 15:21:34 +00:00
tox_unpack.c Split tox_unpack into two smaller libs 2022-02-10 15:34:35 -05:00
tox_unpack.h Split tox_unpack into two smaller libs 2022-02-10 15:34:35 -05:00
tox.c cleanup: Remove some more implicit bool conversions. 2022-03-01 18:16:11 +00:00
tox.h fix: Report failure to DHT bootstrap back to the client. 2022-02-24 11:37:47 +00:00
util_test.cc cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
util.c cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00
util.h cleanup: Remove more boolean conversions (and a bugfix). 2022-02-26 00:03:56 +00:00