Commit Graph

4933 Commits

Author SHA1 Message Date
iphydf
2856943531
chore: Expose public API headers as files in bazel.
They were already exposed as `cc_library`, but we need to make the files
as text available so that binding generators can access them.
2022-01-17 01:03:47 +00:00
iphydf
4ce02c0af9
refactor: Deduplicate a bunch of code in TCP client/server.
Also generally a bit of cleanup and better layering.
2022-01-16 09:41:08 +00:00
iphydf
044ae636a3
chore: Mark unsafe code as testonly.
We want to ensure that nobody links against testing code in production.
2022-01-16 09:10:53 +00:00
iphydf
f52bc798c8
cleanup: Split large switch statement into functions. 2022-01-16 02:45:24 +00:00
iphydf
f7557b4c16
cleanup: Even more pointer-to-const parameters.
I missed these the first time around.
2022-01-16 02:35:08 +00:00
iphydf
c7ecee7c15
cleanup: Remove old check Suite compat layer.
This doesn't do anything useful for us. It was there so we don't need to
rewrite the tests (which I just did). Finally this is now cleaned up.
2022-01-16 01:37:37 +00:00
iphydf
422c8d1125
cleanup: Make parameters pointers-to-const where possible. 2022-01-16 01:28:25 +00:00
iphydf
09bb9b8a23
cleanup: Make Networking_Core pointer-to-const where possible. 2022-01-16 01:09:44 +00:00
iphydf
c081a50201
cleanup: Use pointer cast instead of memcpy in qsort callback.
No need to make copies of the data. There is no concurrency in qsort.
2022-01-16 00:12:44 +00:00
iphydf
0d27eb2f90
cleanup: Deduplicate a somewhat complex loop in DHT.c. 2022-01-15 21:25:14 +00:00
iphydf
2671095f4a
cleanup: Merge crypto_core and crypto_core_mem.
The remaining memory functions are small and don't need their own file.
2022-01-15 01:34:14 +00:00
iphydf
6823fcbae1
cleanup: Stop using strerror directly.
We have a more portable wrapper that is now also thread-safe. Also
stopped using sprintf in the one place we used it. This doesn't really
help much, but it allows us to forbid sprintf globally.
2022-01-15 01:25:56 +00:00
iphydf
fdacd81524
cleanup: Remove our only use of sprintf.
Replaced with snprintf.
2022-01-15 00:52:51 +00:00
iphydf
8d19757f8e
chore: Add mypy Python type check.
Also fix the types in all Python files.
2022-01-14 19:55:37 +00:00
jfreegman
62cbd5f667
Add a couple more bootstrap nodes to autotests
A little more redundancy can save a lot of pain debugging non-existent
problems
2022-01-14 14:40:14 -05:00
iphydf
c81038c963
chore: Add sonar-scan analysis on pushes.
We can't run this on pull requests because it needs access to the
`SONAR_TOKEN` secret. Perhaps in the future we can make it a
`pull_request_target` workflow, but then we can't use cmake to initialise
the environment, meaning we need to specify the inputs manually.
2022-01-14 12:38:35 +00:00
iphydf
d23222c92f
chore: Run static analysers in multiple variants.
Currently: 1) libsodium and 2) nacl.

Note that the "nacl" variant is actually libsodium. We just want to make
sure the static analysers see the `VANILLA_NACL` code paths.
2022-01-14 10:45:11 +00:00
jfreegman
dfa7a0183f
Refactor toxav_call_control
Control logic is now placed in control-specific helper functions
instead of having one giant confusing function that does everything
2022-01-13 17:50:39 -05:00
iphydf
28b5e512a2
fix: Fix toxav_basic_test buffer overflow.
We should pass the number of samples, not the byte size of `PCM`.
2022-01-13 22:36:53 +00:00
sudden6
2073d02c33
fix: don't count filetransfer as sending until accepted
This fixes high CPU load in c-toxcore due to started but not accepted
file transfers causing lots of iterations in do_all_filetransfers(...).
Additionally this skips expensive calls max_speed_reached(...).
2022-01-13 21:41:12 +00:00
iphydf
4a2cb37e4b
fix: Fix some uninitialised memory errors found by valgrind and msan.
Also added a valgrind build to run it on every pull request. I've had to
disable a few tests because valgrind makes those run infinitely slowly,
consistently timing them out.
2022-01-13 20:15:21 +00:00
iphydf
46a443f188
chore: Ignore failures from bazel-tsan and bazel-asan.
Also increased memory limits so it doesn't OOM.
2022-01-13 00:36:34 +00:00
iphydf
685b78d31d
chore: Add asan/tsan bazel builds.
These have all dependencies built with asan/tsan, so they can do deeper
sanity checks such as checking what opus is doing with our buffers.

The asan check currently fails for me locally, so these are not yet set
to be required for PRs to be merged.
2022-01-12 20:33:21 +00:00
jfreegman
360acd0f42
Replace all instances of atoi with strtol
atoi doesn't check if the conversion from string to int succeeded
which doesn't allow us to do proper error handling.

We also now make sure that the port argument is a valid port
in addition to being properly converted
2022-01-12 14:08:45 -05:00
iphydf
9b7279ab24
chore: Run tokstyle with 3 cores.
This seems to be the sweet spot for the current tokstyle implementation.
4 cores gives the same speedup, 5 also, 6 makes it slower, and 2 also
makes it slower.
2022-01-12 18:52:46 +00:00
iphydf
f5f22a5c76
chore: Enable layering check in all c-toxcore build files. 2022-01-12 18:33:13 +00:00
Maxim Biro
ce4b01df94
Fix the compiled out code too
Has the same double-unlock issue as the previous commit.

It also looks like rtp_free_msg() is gone and free() should be used
instead.
2022-01-12 10:49:33 -05:00
Maxim Biro
dbcfc8265e
Fix a double-unlocking mutex
Fixes #1694

Thanks to @ryancaicse for the pointer!
2022-01-12 10:49:30 -05:00
iphydf
cfb0aa8f25
cleanup: Remove extra parens around function arguments. 2022-01-12 07:02:29 +00:00
iphydf
c1b32bd7a1
chore: Enable compiler layering check.
This ensures that we're explicit about what we depend on and avoids
transitive dependencies.
2022-01-11 15:26:32 +00:00
iphydf
eebc516d55
chore: Disable the OpenMP cracker in bazel for now.
I broke it. I'll re-enable it if/when I fix omp support in the bazel
build.
2022-01-11 13:29:53 +00:00
sudden6
faf39ef94f
update tox-bootstrapd.sha256
__LINE__ macros were changed due to inserting #ifdef
2022-01-10 21:05:51 +01:00
sudden6
e04b890817
add scripts to run the fuzzing process
This adds scripts and Dockerfiles to run the fuzzing process standalone
or with OSS-Fuzz/ClusterFuzzLite integrations.
2022-01-10 21:05:51 +01:00
sudden6
7dd8dbd897
intercept network, crypto and time
This fuzzing harness must be as deterministic as possible for the fuzzer
to detect additional coverage reliably.
2022-01-10 21:05:49 +01:00
sudden6
9eb88798a3
add fuzzing harnesses
Toxsave harness ported to libFuzzer interface.
New harness for bootstrap phase.
2022-01-10 20:57:00 +01:00
iphydf
210ea9e25c
chore: Retry asan/tsan tests a few more times.
These are somewhat flaky. A few more retries should make them pass unless
they are properly broken. Most of the time they time out and one more
attempt would pass it. I've added 2 more attempts.
2022-01-10 14:46:58 +00:00
iphydf
f46f51e554
cleanup: Don't use memcpy where assignment can be used.
See https://github.com/TokTok/hs-tokstyle/pull/104.
2022-01-10 10:58:42 +00:00
Robin Linden
7411f70109
Output test logs on failure in Conan build 2022-01-10 02:27:13 +01:00
Robin Linden
23df660fd2
Remove always-true check in receivepacket error handling 2022-01-10 02:27:13 +01:00
Robin Linden
f78c741790
Update MSVC auto test disables to match what somewhat reliably works 2022-01-10 02:27:13 +01:00
Robin Linden
091dc6c833
Fix many MSVC auto tests failing due to WSAECONNRESET 2022-01-10 02:27:13 +01:00
Robin Linden
d2ef514569
Disable building cracker with MSVC
It uses OpenMP features MSVC doesn't support.
2022-01-10 02:27:13 +01:00
Robin Linden
11c9c05213
Don't ignore build/test failures in Appveyor 2022-01-10 02:27:12 +01:00
iphydf
5ab301ecab
chore: Remove all references to Travis CI.
Travis gave up on FOSS, so no more free advertisement for Travis.
2022-01-10 01:17:46 +00:00
iphydf
73484d8995
cleanup: Use calloc instead of malloc for struct allocations.
`malloc` is used only for byte/int arrays. Also, we no longer allow plain
`void *` allocations. Every allocation should have a real value type.
2022-01-09 22:42:50 +00:00
iphydf
9ab77e015d
cleanup: Fix calloc argument order.
See https://github.com/TokTok/hs-tokstyle/pull/102
2022-01-09 18:42:20 +00:00
iphydf
83d5d0d280
cleanup: Remove useless parentheses. 2022-01-06 20:36:03 +00:00
Robin Linden
fe7b467df4
Add a GH Actions code coverage job 2022-01-06 16:39:48 +01:00
sudden6
d2bf72479c
fix: use correct sample size in toxav_basic_test 2022-01-04 21:12:57 +01:00
jfreegman
0385315200
Make struct typedefs have the same name as their struct 2022-01-04 11:36:28 -05:00