We were leaving a self_connection_status callback attached to tox1 while
reloading tox2 and 3, the only other toxes in the network. This lead to
tox1 occasionally going offline, triggering the "Tox went offline"
assert and failing the test.
I don't know if this will actually work, or how many of these "fixes" I
need to get msan to be happy on CI. For me locally, it all works fine.
On CI, for some reason it's not fine even though I run in the exact same
docker image as CI.
This happens when shutting down a toxav session when it still has some
packets in its internal queue. It's not a serious leak and happens very
rarely (1 in 300 runs of the toxav_many_test), but it can happen and
long-running tox instances that start and end calls a lot would
eventually discover this.
Almost nothing used these. The one thing that did only does it to get a
`Mono_Time` object. We should probably get that from elsewhere, but for
now the refactoring is just this simple move.
For coverity, which continues to think we're overrunning buffers when
at this point it's easy to prove we're not. Here would be the corrected
coverity finding:
6. Condition packet_length <= 105 /* 1 + 32 * 2 + 24 + 16 */, taking false branch.
7. Condition packet_length > 1024, taking false branch.
Now packet_length must be > 105 and <= 1024.
12. Condition len1 == packet_length - (89 /* 1 + 32 * 2 + 24 */) - 16, taking true branch.
len1 must be > 0 (105 - 89 - 16) and <= 919 (1024 - 89 - 16).
14. decr: Decrementing len1. The value of len1 is now between 0 and 919 (inclusive).
This is where coverity goes wrong: it thinks len1 could be up to 2147483629.
15. buffer access should be OK. Coverity thinks it's not.
Nothing very noteworthy, I just came across this and made it slightly
more readable.
I'm not making this function `bool` right now because it's used in NGC
and that will break.
As a side-effect, DHT now always accepts LAN discovery packets, even
when LAN discovery is disabled. When LAN discovery is disabled, those
packets are ignored.
These don't test anything that isn't covered by higher level tox tests.
These are also not unit tests and have never found any bug that wasn't
also caught by other tests. This makes them a pure maintenance burden.
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
g++ doesn't emit these warnings properly, so the `run-gcc` tool, which
compiles code as C++, doesn't work for all of these. There are a few
builds that do use GCC, e.g. the sonar-scan build, so these flags will
be passed at some point in CI.
These were found by the new cimple type check which is completely
unforgiving to implicit boolean conversions. After this PR, there should
be no more implicit int-to-bool or bool-to-int conversions.
These were found by the new stronger type check in cimple. The one
bugfix is in `crypto_sha512_cmp`, which used to think `crypto_verify_32`
returns bool while actually it's -1/0/1.
Tokstyle will require this format:
- Optionally a single include (the module header).
- System includes.
- Local includes.
In headers, there is no module header to include, so system includes
come first there.
Enums should be fairly strong type guarantees about the possible value
range. The API says the return value is unspecified, so this is not a
breaking change.
This uses mallocfail to further increase coverage using the existing
tests. Also:
* Moved the non-auto "tox_one_test" to gtest. This should be
split into smaller tests later.
* Changed `hole_punching` to `bool`.
This forces the onion to consider all friends as new after a 10 second
period of the onion being disconnected. new friends are aggressively
searched for in the DHT, whereas old friends are only searched for in
intervals spanning minutes.