Commit Graph

4999 Commits

Author SHA1 Message Date
iphydf e7bc611dac cleanup: Enable most cppcheck warnings as errors.
Cleaned up some of the warnings it gives. Disabled the ones that are
less useful for us at this time.
2022-02-21 17:17:36 +00:00
iphydf 86a528a37a chore: Add a .clang-format that mostly agrees with astyle. 2022-02-21 16:16:16 +00:00
iphydf a9ccf1be26 cleanup: Remove all implicit bool conversions in if-conditions.
Note to reviewer: please review carefully. This was done manually.
2022-02-21 15:10:22 +00:00
sudden6 fff2b1c4e7 fix: out-of-memory condition by corrupted save file
Don't allocate the memory trusting the values in a toxsave file.
2022-02-21 13:54:32 +01:00
sudden6 12dbafbd18 fix: memory leak during conference load
This was found in our continous fuzzing setup.
2022-02-20 21:23:09 +01:00
iphydf 6a6bc029de cleanup: Remove unused execution trace library. 2022-02-19 11:44:13 +00:00
iphydf a6426d7e7a chore: Make coverity scan a nightly job.
Instead of on every push. It only produces results once a day anyway.
2022-02-19 02:47:36 +00:00
iphydf 68f4e5c0fa chore: Simplify and speed up windows builds using docker image. 2022-02-19 00:47:37 +00:00
iphydf c44930d323 chore: Fix build-args in win32/win64 docker build. 2022-02-19 00:46:34 +00:00
iphydf 570485e186 chore: Add docker image builds for windows cross compiler. 2022-02-19 00:08:33 +00:00
Robin Linden 1937ee39c3 Release 0.2.16 v0.2.16 2022-02-19 00:51:01 +01:00
iphydf d46091072d chore: Remove msan from all CIs except circleci.
It doesn't work yet and is wasting CI resources.
2022-02-18 22:21:01 +00:00
iphydf c5e3bca6de chore: Simplify and speed up nacl build using toxchat/nacl. 2022-02-18 22:13:42 +00:00
iphydf 4389c71619 test: Add a profiling script and Dockerfile.
This works on my kernel. If your kernel is older/newer, you may need a
different alpine base image that matches your kernel more closely.
2022-02-18 21:38:55 +00:00
sudden6 fde2a7d16d fix: properly deallocate frozen peers 2022-02-18 15:59:55 +01:00
iphydf 84a03bc2ed cleanup: Enable tokstyle's -Wlarge-struct-params. 2022-02-18 10:49:46 +00:00
iphydf 87c38ece30 cleanup: Avoid implicit bool conversions in logical operators. 2022-02-18 10:24:31 +00:00
iphydf cc045d6343 cleanup: Avoid implicit boolean and floating point conversions in decls.
Also avoid implicit enum-to-int.
2022-02-18 03:26:12 +00:00
iphydf 598a365e1f fix: Fix return type of functions returning uint64_t.
They were losing precision by going through uint32_t.
2022-02-18 00:30:40 +00:00
iphydf 7b2f6c34c6 cleanup: Apply stronger type checks and fix errors.
Found a bug, too: file recv and chunk events were intermittently
converting to `uint32_t`, losing precision.
2022-02-17 22:34:56 +00:00
jfreegman 0f3534656f Improve how we share TCP relays with friends
Previously we would try to send three random TCP relays that we're
connected to to each friend once every 5 minutes. The problem with
this method is that it could take an extraordinarily long time
to share every relay; some relays might be consistently skipped
while others might be sent repeatedly. Moreover, there's no
guarantee that the nodes you try to send are actually online.
This leads to a prety unreliable and flaky way of sharing.

Now we reduce the timer to two minutes, and cycle through the list
trying 3 nodes each share attempt. This guarantees that every online
node in our list gets shared with every friend after a fixed amount of
time (which depends on how many nodes are in the list)
2022-02-17 16:16:29 -05:00
iphydf 5e724d8909 cleanup: Avoid implicit pointer-to-bool conversion in if in toxav. 2022-02-17 20:33:24 +00:00
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