Commit Graph

4796 Commits

Author SHA1 Message Date
zugz (tox)
f12347dfec
Fix buffer over-read when a peer leaves a conference
Fixes 1598 -- thanks to peirick for reporting the bug.
2021-12-01 20:31:50 +00:00
iphydf
57b0651ffd
test: Add some unit tests for important internal DHT functions.
We definitely need more of this kind of test so refactorings don't
accidentally break things in ways that happen to still work in auto
tests.
2021-12-01 14:08:37 +00:00
sudden6
fd73f3eeb6
add logging when connection limits file transfer speed 2021-11-30 15:55:00 +01:00
sudden6
286cc44f54
rewrite filetransfer logic in Messenger.c
Makes the logic easier to follow and removes suspicious case.
2021-11-30 15:54:58 +01:00
sudden6
10ddf8097c
rewrite loop for better understanding 2021-11-30 15:53:31 +01:00
sudden6
825d457073
simplify do_all_filetransfers
This should not change any behaviour of this function.
2021-11-30 15:52:27 +01:00
zugz (tox)
01c3869bd0
Add instructions for building unit tests to INSTALL.md 2021-11-30 14:10:16 +00:00
sudden6
0c320462d7
perf: reduce calling into Mono_Time in DHT
Mono_Time needs to acquire a lock each time one of its functions are
used. This becomes very costly in the DHT code where timeouts for all
connected nodes are recalculated. Improve this by caching the timestamp
at the begin of a do_dht() iteration.
2021-11-29 19:02:17 +01:00
jfreegman
8b725c1ecc
Fix some friend connection issues
- Properly handle crypto_connection_status() failure
- Remove CONNECTION_UNKNOWN and restructure surrounding logic so that
  the API no longer reports erroneous friend connection statuses
2021-11-27 19:27:55 -05:00
jfreegman
c0a0a8204c
Fix bug causing API to report wrong self connection status 2021-11-27 18:43:35 -05:00
iphydf
99d873b985
chore: Enable cimple tests on cirrus build.
This ensures that we don't break Cimple compatibility despite Travis
being gone (which used to test this).
2021-11-27 02:56:17 +00:00
jfreegman
b66165977e
fix issue with save_load autotest
The test explicitly wanted a UDP connection when a TCP connection would suffice. This
was a remnant of back when the test was part of a multi-purpose autotest that
didn't attempt to connect to TCP relays and needed a UDP connection specifically.
2021-11-25 15:32:29 -05:00
iphydf
1700334c3b
chore: Upgrade to toktok-stack:0.0.11. 2021-11-25 18:32:50 +00:00
cryptogospod
13cca6716d
Update IRC info 2021-09-18 00:02:57 +02:00
Robin Linden
485fe88253
Get Appveyor and Cirrus CI to pass again
* Fix Appveyor CI build

The problem was that when running commands in powershell, any stderr
output is treated as an "exception", stopping the build even if the exit
code of the command was good.

* Add workarounds to get Cirrus CI to pass

Removing the cache isn't great, but the build is still only 5-7 minues,
so it's not terrible either.

Disabling the tcp_relay test also sucks. It passes locally, so we're
likely getting caught in a firewall or something like it somewhere.
2021-09-17 23:43:09 +02:00
sudden6
25a56c3549
simplify do_tcp(...) 2021-04-12 19:01:10 +02:00
Alexandre Petitjean
c9ad4a2e39
Enable c-toxcore conan packaging 2021-04-11 15:56:02 +02:00
Maxim Biro
6f3cdb1780
Remove references to Tox's package repository
Since it's shut down
2021-03-02 04:25:53 -05:00
Maxim Biro
d8c676bb01
Remove references to Jenkins
Since we are shutting it down
2021-03-02 04:25:32 -05:00
Maxim Biro
0d5f85485b
Update deps used in Windows build scripts 2021-02-25 13:59:18 +03:00
redmanmale
98c148179f
Add Cygwin build script 2021-02-25 13:57:42 +03:00
Robin Linden
a71ddc7eac
Fix tests involving reading/writing files failing on Windows
The issue was that r and w without the b flag on Windows does LF and CR
translations when reading and writing. Not good for binary files.
2020-11-21 13:02:31 +01:00
jfreegman
00f2f41dbb
Use heap memory instead of stack for large variables
The default stack size for musl-libc is 128kb. Therefore we should try to keep stack
allocations well below this limit in order to avoid stack overflows.
2020-11-20 19:15:58 -05:00
Robin Linden
5d2b1e3861
Update tox-bootstrapd checksum due to newer packages in Alpine
* g++       9.2.0-r4  -> 9.3.0-r0
* gcc       9.2.0-r4  -> 9.3.0-r0
* libatomic 9.2.0-r4  -> 9.3.0-r0
* libcurl   7.67.0-r0 -> 7.67.0-r1
* libgcc    9.2.0-r4  -> 9.3.0-r0
* libgomp   9.2.0-r4  -> 9.3.0-r0
* libstdc++ 9.2.0-r4  -> 9.3.0-r0
* python3   3.8.2-r0  -> 3.8.2-r1
2020-11-16 16:22:55 +01:00
Robin Linden
470fa79f92
Fix AppVeyor failing due to conan remote being added twice 2020-06-12 11:25:55 +02:00
Robin Linden
56992b099e
Add support for the conan C/C++ package manager
* Don't overwrite the CMAKE_MODULE_PATH
* Allow linking libsodium statically with MSVC
* Allow finding libsodium the normal way on MSVC
* Allow using pthreads4w for pthreads on MSVC
* Fall back to find_package if pkg_find_module fails
* Don't pass incompatible compile flags to MSVC
* Also try to find Opus and libvpx using their canonical names
* Support building using conan
* Allow pkg_use_module to take a list of libraries to look for
* Build for Windows on Appveyor using conan
2020-05-29 15:36:26 +02:00
iphydf
03a511482f
Format comments according to tokstyle's requirements. 2020-05-17 18:16:42 +01:00
iphydf
fe8e0fb8fa
Fix tcp_relay_test by adding a second bootstrap node.
This is a non-hermetic network test. initramfs node is down, so let's
have a second one for redundancy.
2020-05-17 12:41:00 +01:00
iphydf
3d601fe320
style: Run restyled on Travis and Circle CI scripts. 2020-05-08 01:31:24 +01:00
iphydf
8f4400b9b4
cleanup: Make pylint and mypy happy with bootstrap_node_info.py. 2020-05-06 10:59:47 +01:00
iphydf
3851cfb652
Add autotools build to localbuild docker images. 2020-05-05 23:41:16 +01:00
iphydf
8c0fd40356
refactor: Remove multi-declarators entirely.
We no longer allow `int a, b;`. In the few cases where we used it, we
instead better

* limit the scope of the identifier (e.g. in a for-init-decl)
* split the line and have 2 separate declarators, because the
  identifiers designate different types of things (e.g. friend numbers
  and group numbers).
2020-05-05 23:22:29 +01:00
iphydf
fd2bb77923
chore: Don't build pushes to branches, only to tags. 2020-05-05 23:10:12 +01:00
iphydf
48bd200acb
refactor: Disallow multiple initialised declarators per decl.
We no longer allow:

```c
int a = 0, b = 0;
int a[3], b[3];
int a, *b;
```

But we do still allow (for now):

```c
int a, b;
```
2020-05-05 22:56:35 +01:00
iphydf
c1a2ea3309
Use bash arrays instead of strings for static analysis scripts.
These are more robust wrt. spaces in names.
2020-05-05 01:53:01 +01:00
iphydf
f8ab7218f0
Exclude imported libsodium sources from restyled.
Also limit clang-format to .cc files. Don't apply it to .c files.
2020-05-05 01:36:16 +01:00
iphydf
9edb2e5088
chore: Delete release-drafter config in favour of global one. 2020-05-05 01:07:59 +01:00
iphydf
d52bf0a947
refactor: Minor cleanup: limit scope of loop iterators. 2020-05-05 00:58:33 +01:00
iphydf
669ea8797b
Fix typo: NAC_LIBS -> NACL_LIBS.
This is working, so probably `NACL_LIBS` is entirely useless, but I
can't be bothered to figure out what this was supposed to be, so here we
are.
2020-05-04 19:54:58 +01:00
iphydf
cc99ecd43a
Stop hard-coding packet IDs in tests. 2020-05-04 02:14:56 +01:00
iphydf
02a5bdc60c
Add logging to TCP and onion client. 2020-05-04 01:27:36 +01:00
iphydf
4efe541814
Add a script to run Travis CI locally.
This isn't quite Travis, but close enough for local testing.
2020-05-03 16:59:26 +01:00
iphydf
88b90c8225
Fix a bug in savedata loading when malloc fails.
Also added a bunch of asserts to tests where they don't check allocs.
2020-05-03 14:13:48 +00:00
iphydf
7b758f66db
Enable cimple tests by default but allow disabling them.
Use `bazel test //c-toxcore/... --build_tag_filters=-haskell` to run all
tests except the ones that depend on Haskell (i.e. cimple tests).
2020-05-03 14:03:54 +01:00
iphydf
f8ab32aaa4
Add a check that we don't have any unused functions.
This check puts all of our code in a C++ anonymous namespace, which is
effectively making all functions `static`. This allows the compiler to
determine that a function is unused, so we can delete it.
2020-05-02 22:00:09 +01:00
iphydf
2570ddcb17
Fix errors on error paths found by oomer.
* Use-after-free because we free network before dht in one case.
* Various unchecked allocs in tests (not so important).
* We used to not check whether ping arrays were actually allocated in DHT.
* `ping_kill` and `ping_array_kill` used to crash when passing NULL.

Also:
* Added an assert in all public API functions to ensure tox isn't NULL.
  The error message you get from that is a bit nicer than "Segmentation
  fault" when clients (or our tests) do things wrong.
* Decreased the sleep time in iterate_all_wait from 20ms to 5ms.
  Everything seems to still work with 5ms, and this greatly decreases
  the amount of time spent per test run, making oomer run much faster.
2020-05-02 21:47:08 +01:00
iphydf
e057bae563
Include <string.h> for explicit_bzero.
We need this for vanilla nacl builds on Linux.
2020-05-02 00:19:55 +01:00
Robin Linden
9be4dbb433
Release 0.2.12 2020-05-01 12:58:27 +02:00
iphydf
7edc0a52fe
Bound the number of friends you can have to ~4 billion.
If you have UINT32_MAX friends, then adding one more friend will cause an
overflow of the friend list (wrap to 0) and result in all friends being
deleted. This subsequently results in a null pointer dereference when
we're trying to add one friend to the deleted friend list.
2020-04-29 12:22:06 +00:00
iphydf
de3c21b5b7
Disable non-hermetic tests by default.
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955319.
2020-04-29 12:09:34 +00:00