Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information