Commit Graph

4977 Commits

Author SHA1 Message Date
iphydf
933c6b7517
refactor: Compare pointers in if conditions to nullptr.
Don't use implicit ptr-to-bool conversion.
2022-02-17 19:55:29 +00:00
iphydf
43fc2374bc
refactor: Add a bit more logging; change WARNING to ERROR.
ERROR is caught in tests, so we'll use it more for things that ought not
to happen.
2022-02-16 23:05:10 +00:00
jfreegman
1f6edc6139
Fix a file transfer bug introduced in commit 2073d02
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.
2022-02-15 17:47:25 -05:00
Rodrigo Martins
96843fbae4
Take advantage of fast networks for file transfers
- 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.
2022-02-15 12:22:11 +00:00
iphydf
1d0f6e51e2
cleanup: Add some more error path logging to TCP server code. 2022-02-15 12:08:22 +00:00
iphydf
c9d3e078e2
chore: Add BUILD file for websockify. 2022-02-14 13:56:18 +00:00
sudden6
4d79001991
chore: fine tune fuzzing settings 2022-02-14 13:54:52 +01:00
Maxim Biro
25216f86e7
Don't attempt to install the same package twice 2022-02-13 22:54:10 -05:00
Maxim Biro
dcc65c385f
Update Windows Docker build deps 2022-02-13 22:54:08 -05:00
Maxim Biro
3baf169da1
Use a bit less random example for options
Just in case someone treats these options as a recommendation, which
they are not, they are there just to show how to set various data types.
2022-02-13 22:23:35 -05:00
Maxim Biro
b36014ab36
Update the list of CMake options 2022-02-13 22:22:27 -05:00
sudden6
acf85eee46
fix: remove bogus asserts in fuzzer harness 2022-02-14 00:38:42 +01:00
sudden6
acc8b6faa6
chore: expand fuzzing to toxsave 2022-02-13 23:46:52 +01:00
sudden6
d429d35756
fix: syntax error introduced in 8bf37994fd 2022-02-13 18:36:36 +01:00
sudden6
8bf37994fd
chore: add manual trigger to fuzzing builds 2022-02-13 16:01:57 +01:00
sudden6
7e1aa442ef
fix: add msgpack dependency to fuzzer build 2022-02-13 16:01:55 +01:00
Robin Linden
40a6bab886
Fix implicit declaration warning in fuzz build 2022-02-13 15:30:14 +01:00
sudden6
6400b13754
chore: add continous fuzzing to our CI 2022-02-12 20:19:09 +01:00
iphydf
a3cd1102f7
perf: Reduce minimal encoding size of packed events.
We're using a union-like encoding now with an enum telling which union
member to set.
2022-02-12 17:44:44 +00:00
jfreegman
a06a736321
Add wrapper library for msgpack pack functions
This allows us to abstract out some of msgpack's quirks
and gives us symmetry with bin_unpack.c
2022-02-11 22:11:32 -05:00
iphydf
33588c1aad
cleanup: Don't use VLAs for huge allocations.
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).
2022-02-11 03:05:30 +00:00
cryptogospod
86ed00a218
docs: Add libmsgpack dependency in INSTALL.md 2022-02-11 00:01:19 +01:00
Robin Linden
dd19856a6c
chore: Set up an Android CI job 2022-02-10 23:31:09 +01:00
iphydf
73d52cdb33
chore: Disable non-null attributes by default.
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).
2022-02-10 21:33:51 +00:00
jfreegman
a0a317db49
Split tox_unpack into two smaller libs
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
2022-02-10 15:34:35 -05:00
jfreegman
6dc1656e28
Silence clang compile warnings causing circle-ci/asan to fail 2022-02-10 14:11:58 -05:00
jfreegman
73ba0504b0
Add autotest for dht getnodes API
The test creates a small DHT and makes sure that each
peer is able to crawl the full network
2022-02-10 10:33:34 -05:00
jfreegman
652ae27eeb
Add DHT queries to private API
This commit adds functionality for clients to interact with
the DHT, sending getnodes requests to their peers and receiving
nodes in getnodes responses.
2022-02-10 10:33:31 -05:00
Maxim Biro
e58ee06492
Fix Coverty scan 2022-02-10 10:11:22 -05:00
Maxim Biro
df1bfbecd7
Turn autotools warnings into errors 2022-02-10 08:16:12 -05:00
Maxim Biro
bab4949433
Get skeletons out of the closet
The test was removed in c7ecee7c15 but
the entries in the build system remained, causing autotools to spit out
warnings.
2022-02-10 08:16:10 -05:00
Maxim Biro
836201e333
Add custom path options for msgpack in autotols 2022-02-10 05:28:05 -05:00
Maxim Biro
6e8ea97c06
Fix shared toxcore autotools build failing
Turns out libtoxcore.so wasn't being linked against libmsgpackc.
2022-02-10 05:28:03 -05:00
Maxim Biro
2965403e2c
Add bash-completion for tox-bootstrapd 2022-02-10 02:40:42 -05:00
iphydf
8002c35c79
chore: Remove duplicate source file in autotools build. 2022-02-09 20:49:34 +00:00
Robin Linden
6ee8fa0218
chore: Fix Appveyor failing due to adding a remote that already exists
Also drop the cache whenever the conanfile.py changes to ensure that we
don't work against stale data when adding dependencies and things.
2022-02-09 21:38:55 +01:00
Robin Linden
b64825b389
fix: Fix Conan build link failures 2022-02-09 21:38:52 +01:00
iphydf
10f86f6c00
cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
iphydf
5a3a0b6453
cleanup: Add nonnull annotations to function definitions.
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.
2022-02-08 17:57:47 +00:00
iphydf
6f36b67a13
chore: Add an undefined behaviour/integer sanitizer build. 2022-02-08 09:18:18 +00:00
iphydf
71d5f8a4c3
chore: Speed up cmake builds with UNITY_BUILD.
`dht_test` breaks with unity build because it includes `DHT.c`. It
really shouldn't do that, but I'm not fixing that in this PR.
2022-02-08 01:07:58 +00:00
iphydf
cb8b9bbabf
feat: Add unpacker functions for events structures. 2022-02-08 00:02:51 +00:00
iphydf
0a2190f28c
feat: Add binary packing functions for tox events. 2022-02-07 02:43:24 +00:00
iphydf
9218566599
cleanup: Make LAN discovery thread-safe without data races.
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.
2022-02-06 19:56:34 +00:00
iphydf
de4af4c270
feat: Add async event handling (callbacks) code.
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.
2022-02-06 17:28:28 +00:00
iphydf
cde796f1f8
cleanup: Comply with new cimple callback rules.
* 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.
2022-02-06 16:45:41 +00:00
iphydf
4d4120214a
chore: Add an easy way to run autotools and circleci builds locally. 2022-02-06 15:48:02 +00:00
Robin Linden
f87a6df938
cleanup: Split msi callback array into 1 member per callback 2022-02-06 15:45:24 +01:00
Robin Linden
bd71210e6f
Update readme header
* 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.
2022-02-06 06:57:00 +00:00
Robin Linden
d93e795cfe
Release 0.2.15 2022-02-06 04:40:03 +01:00