Commit Graph

4854 Commits

Author SHA1 Message Date
iphydf
36cb30d47d
Check that LOGGER macros are only called with string literals.
Avoid any dynamic format strings, even ones like `cond ? "str1" : "str2"`.
2020-03-18 14:51:56 +00:00
iphydf
1b7bf5b182
Mark file-local function definitions as static.
https://github.com/TokTok/hs-tokstyle/pull/43 implements a validation for
this. We should avoid locally declaring functions from another
translation unit, and instead use header files to export/import them.
2020-03-18 00:53:02 +00:00
iphydf
983c2c44fe
Enable remote cache for bazel builds. 2020-03-17 03:21:54 +00:00
iphydf
52696a0686
Add another bootstrap node to the bootstrap test.
Hopefully not both will be down at the same time.
2020-03-15 23:53:59 +00:00
zugz (tox)
52655b0c1b
clean groups code
* make static functions return bool rather than int to indicate success
* add peer_in_list() to factor out uniformity over peer and frozen lists
* reduce repetition in send_lossy_all_close
* rename 'close' to 'connections'
* use uint32_t for peernumber (in accord with tox.c)
* explain persistence in tox_conference_get_chatlist documentation
* clarify "connectedness" in group API documentation
* clarify that tox_conference_peer_count counts only online peers
* refactor variously
2020-03-15 00:00:27 +00:00
iphydf
8795c5f987
Avoid casting back and forth between void-ptr.
In windows network code, we implement inet_pton and inet_ntop, which take
void pointers. We can do slightly better because we already know the type
when we call these functions, so we can avoid casting between void
pointer and the addr struct types.
2020-03-14 13:48:56 +00:00
iphydf
94d98ddd86
Standardise on having a comma at the end of enums.
Most of our enums already have one. Some didn't. Tokstyle is going to
require commas at the end of enumerator lists in enum definitions.
2020-03-14 13:40:36 +00:00
iphydf
cb22b3df5f
Fix up comments a bit to start being more uniform.
Tokstyle (check-cimple) will start enforcing comment formats at some
point. It will not support arbitrary stuff in comments, and will parse
them. The result can then be semantically analysed.
2020-03-14 13:28:42 +00:00
iphydf
11ad5471b9
Use spdx license identifier instead of GPL blurb. 2020-03-14 13:06:19 +00:00
zugz (tox)
c644ef7681
use -1 rather than ~0 in unsigned integer types
Using ~0 involves a bitwise operation on int, so depends on
the internal representation of signed integers.
2020-03-14 00:00:02 +00:00
iphydf
e671490989
Use rules_cc instead of native cc_library rules. 2020-03-12 12:20:54 +00:00
iphydf
64bf3695d9
Add a mutex lock/unlock inside every public API function. 2020-03-11 15:21:43 +00:00
Maxim Biro
fd5511ad37
Enable FreeBSD jobs on Travis-CI 2020-03-10 06:35:48 -04:00
Maxim Biro
26fd89437b
Update and fix FreeBSD setup on Travis-CI
- Bump FreeBSD to 12.1.
- Simplify stage1 logic.
- Re-try downloading the image from a different mirror if one fails.
- Use the `expect` utility instead of dealing with screen's log file.
- Re-run failed toxcore test one more time and in sequence.
2020-03-10 06:16:00 -04:00
iphydf
bd7b7fadba
Pass packet ID to custom packet handlers.
We don't expose this to the user code, yet, because it would break the
API, but this is useful for future internal code.
2020-03-08 19:17:50 +00:00
iphydf
7b3d2eda3f
Use net_pack instead of casting bytes to ints.
The current code violates the C standard and causes crashes on strict
alignment architectures.
2020-03-06 11:05:52 +00:00
iphydf
7923a61959
Use ninja build system for the cmake-linux build. 2020-03-05 23:02:54 +00:00
iphydf
e35d70af18
Use net_pack/unpack instead of host_to_net.
The latter is doing pretty much the same thing but in a confusing way (it
doesn't change the type of the variable, but does change the semantics).
2020-03-05 22:56:26 +00:00
iphydf
cbc26d9b16
Disable FreeBSD travis build until it is fixed. 2020-03-05 13:09:01 +00:00
Maxim Biro
7c63b0f734
Update tox-bootstrapd's dockerfile to use Debian Buster 2020-03-03 01:23:24 -05:00
Maxim Biro
ac5c9ebce4
Fix tox-bootstrapd's README 2020-03-03 01:23:22 -05:00
iphydf
28baf9632f
Remove testing/av_test.c.
It's a maintenance burden. Nobody uses this. It depends on an ancient
version of opencv that less and less systems actually have.
2020-03-02 21:07:55 +00:00
zugz (tox)
2dc639a8a4
bump to astyle-3.1 in travis build 2020-03-02 15:31:48 +00:00
iphydf
e618829112
Add "cimple_test" to the bazel build. 2020-03-02 15:20:34 +00:00
iphydf
0f7138c010
Upgrade bazel to 2.1.1.
Removed av_test, because it depends on an ancient opencv that starts to
really not exist on modern systems anymore.
2020-03-02 14:23:44 +00:00
zugz (tox)
f6c3ce6d1f
handle message_number wraparound 2020-01-22 00:00:02 +00:00
zugz (tox)
886b9a7019
workaround for message number saving (fixes #961)
Put a future message number into the save file.

Peers require the message numbers of messages we send to increase
monotonically. If we save the current message number, then send further
messages, then quit without saving (e.g. due to a crash), and then
resume from the old save data, then monotonicity will fail. This commit
works around this problem by introducing an offset when the current
message number, so that even in the above circumstance, as long as fewer
messages than the offset were sent between saving and reloading, the
sent message numbers will increase monotonically.

The choice of offset is a balance between wanting it to be large enough
that there is room for plenty of messages to be sent in the above
scenario, and wanting to avoid the following potential problem: if we
repeatedly save and reload without sending any further messages, then
the message number may increase so far that peers will interpret an
eventual message as being old. This is not conceivably a practical issue
for the 32bit lossless message numbers, but is a concern for the 16bit
lossy message numbers.
2020-01-22 00:00:02 +00:00
zugz (tox)
e6cbe907ac
refactor 2020-01-22 00:00:00 +00:00
sudden6
683bc802e2
fix ToxAV threading documentation
ToxAV is not thread-safe at the moment, remove that claim from the
header file.
2020-01-02 11:58:52 +01:00
sudden6
1b7d7b66c5
synchronize call control actions to tox_iterate 2020-01-02 11:58:42 +01:00
sudden6
393a6be5c4
don't wait for connection when killing Tox
When tox_kill is called no other thread should be running anymore so
this locking is not needed there.
2019-12-25 14:56:43 +01:00
sudden6
6338cb46ad
fix invalid use of mutex
- Moving a pthread_mutex in memory (e.g. via realloc()) is undefined
  behavior.
- add a state for allocated but not yet used crypto connections
- change crypto_connection_status signature
2019-12-23 23:48:15 +01:00
sudden6
abfd90d25b
fix log message creating data race 2019-11-21 23:47:03 +01:00
sudden6
a29d5805a6
fix missing mutex 2019-11-21 23:47:02 +01:00
sudden6
81728addb2
fix ToxAV mutex released to early 2019-11-21 23:46:59 +01:00
crypto-universe
74fc646d45
Add VScode folder to .gitignore 2019-11-17 13:59:12 +01:00
zugz (tox)
08e6a1863e
bump libsodium version in appveyor.yml and windows Dockerfile 2019-11-17 13:40:34 +01:00
zugz (tox)
2677a53ee0
Fix miscellaneous small problems with groups:
* unset global status callback in kill_groupchats
* avoid dangling friend connections
* fix num_introducer_connections leak
* stop trying to keep connection alive on freeze
* avoid relaying lossless messages back to sender where possible
* avoid sending gratuitous online packets
2019-11-17 13:29:10 +01:00
Robin Linden
79748dd9e5
Allow Bazel to rerun tests marked as flaky 2019-11-17 01:24:02 +01:00
Robin Linden
f6235b5f8d
Update tests to use a working bootstrap node 2019-11-02 15:35:21 +01:00
Robin Lindén
1f89a57180
Fix pthread_mutex_destroy getting too many arguments 2019-09-18 23:26:13 +02:00
sudden6
ca370df651
don't update the overflow state in current_time_monotonic
This could make mono_time loose overflows on Windows.
2019-09-09 01:31:49 +02:00
sudden6
571897cecb
fix concurrency issues in mono_time
Since mono_time is accessed from the main thread as well as the toxav
thread it is needed to properly lock time updates.
2019-09-06 23:10:39 +02:00
sudden6
3d21e66a8a
fix overflow in peer nick len 2019-08-04 16:38:53 +02:00
sudden6
8ed83c3d4c
fix missing group title length check
This fixes a buffer overflow when a malformed *.tox save file is
loaded.
2019-08-04 16:38:49 +02:00
Robin Lindén
7418174129
Force IPv4 for cirrus-ci tests 2019-07-21 16:23:33 +02:00
Robin Lindén
7aab0d9952
Release 0.2.10 2019-05-30 15:36:12 +02:00
zugz (tox)
306dd1f21f
add configurable limit on number of stored frozen peers 2019-05-19 18:51:28 +02:00
Evgeny Kurnevsky
d26b11d0c2
Do not send the same packet to the same node twice. 2019-05-01 16:40:04 +02:00
sudden6
b3100c977c
add undef guard in tox_many_tcp_test
This fixes an redefinition error when creating amalgamation.cc during
static analysis
2019-05-01 14:24:46 +02:00