This fixes a bug where file transfers would break when the sendto()
system call failed with errno 11 (usually indicating a full packet
buffer).
The max loops constant has also been greatly reduced, as it was
excessively CPU intensive, and most connections would not benefit
from such a high value. In the future it will be set dynamically.
- Make sender send more data per iteration.
- Make receiver iterate more often while receiving.
Before this commit tox would send at maximum around 4MiB/s. With this
patch sustained speeds of up to 100MiB/s were observed on a
low-latency, high-bandwidth network.
As a consequence of iterating more frequently the receiver's CPU usage
is increased for the duration of the transfer. The data structures
used to represent friends and file transfers cause the sender code use
costly loops that do little real work. This patch makes this problem
more visible: the sender uses more CPU while sending.
Poor network conditions were simulated using the netem kernel
facility: $ tc qdisc add dev lo root netem delay 100ms 50ms \
loss 1% duplicate 1% corrupt 1% reorder 25% 50%
and no adverse behavior was encountered. Tests were conducted
using toxic using both UDP and TCP.
One of these was creating a single 262144 byte stack frame. We now have
a way to check and limit the allocation size of a VLA. The `Cmp_Data`
ones were also fairly large. Now, no allocation is larger than 2KiB
(though rtp.c allocates close to that much).
We enable them on CI, but a default build will compile without them so a
default build doesn't end up with lots of warnings (which we also
disable on CI).
tox_unpack is for unpacking Tox types, and bin_unpack is for
unpacking ints and binary data. This prevents us from creating
dependency cycles due to tox_unpack depending on tox.h
This commit adds functionality for clients to interact with
the DHT, sending getnodes requests to their peers and receiving
nodes in getnodes responses.
These help static analysis and ubsan. We should eventually have all
functions annotated like this with a cimple check to make sure every
pointer has an explicit nullability annotation. The `nullable`
annotation does nothing in GCC, but will be used by cimple to validate
that every parameter has defined nullability.
It was kind of thread-safe, maybe, but there was a data race that makes
tsan unhappy. We now do interface detection once per Tox instance
instead of once per process.
Instead of synchronously handling events as they happen in
`tox_iterate`, this first collects all events in a structure and then
lets the client process them. This allows clients to process events in
parallel, since the data structure returned is mostly immutable.
This also makes toxcore compatible with languages that don't (easily)
support callbacks from C into the non-C language.
If we remove the callbacks, this allows us to add fields to the events
without breaking the API.
* Function arguments must use `foo_cb *p` and can't just use `foo_cb p`
* You can no longer cast function pointers (if it's incompatible, you
must wrap the callback). I'm avoiding this with tokstyle exclusions.
* Drop the Travis build status.
* Drop the link to projects since we're not using that GitHub feature
anymore.
* Update the Binaries/Downloads link to point to tox.chat/downloads. The
previous link just lead to a page telling the user to go to
tox.chat/downloads.
* Update the code coverage badge to point to codecov.