Commit Graph

5361 Commits

Author SHA1 Message Date
iphydf 5bdaaaedb6 refactor: Remove Tox * from tox_dispatch.
User data can contain a tox instance if it needs to.
2024-02-04 20:18:26 +00:00
iphydf e202341e76 refactor: Don't rely on tox_dispatch passing tox in tests.
This frees up the dispatcher from having to know that `Tox *` exists.
2024-02-04 20:02:08 +00:00
iphydf 34df938f52 chore: Use C++ mode for clang-tidy.
This enables a bunch more useful checks (and a whole lot of useless ones
we then explicitly disable). In particular, misc-const-correctness now
works and may make `-Wconst` in tokstyle obsolete.
2024-02-04 18:40:27 +00:00
iphydf 8b05296a78 chore: Check that both gtest and gmock exist for tests.
We used to assume gtest installation includes gmock, but some users may
have only gtest and not gmock.

Fixes #2636.
2024-02-03 00:05:01 +00:00
iphydf 42010660e1 test: Add slimcc compiler compatibility test. 2024-02-02 23:50:46 +00:00
iphydf b473630321 chore: Add some comments to the astyle config.
To explain why some options are disabled.
2024-02-02 11:34:29 +00:00
iphydf b7404f24f6 cleanup: Remove implicit bool conversions. 2024-02-02 01:31:54 +00:00
iphydf 4e2dba4d9f chore: Reformat sources with astyle.
Restyled astyle is fixed now.
2024-02-02 01:31:32 +00:00
iphydf 4359e3a6bc chore: Rename C++ headers to .hh suffixes.
This helps formatters and other dump (simple) tools know what's C++ and
what's C.
2024-02-01 23:44:37 +00:00
iphydf 0c05566e58 cleanup: Further #include cleanups. 2024-01-31 21:04:53 +00:00
iphydf 8d29935b7a chore: Only check the bootstrap daemon checksum on release.
It's pure toil until then. It's only interesting as part of the release
checklist, not in regular PRs.
2024-01-31 20:40:49 +00:00
iphydf f70e588bc6 cleanup: Add more const where possible. 2024-01-31 19:55:17 +00:00
iphydf 511bfe39c8 cleanup: Use Bazel modules to enforce proper #include hygiene. 2024-01-30 23:51:43 +00:00
iphydf 1710a0d091 refactor: Move pack/unpack IP_Port from DHT into network module.
It's misplaced in DHT, since the data structures are located in network.
2024-01-30 12:40:52 +00:00
iphydf a975943564 chore: Really fix coverage docker image build.
It made progress, but then the last step failed.
2024-01-30 09:11:44 +00:00
iphydf c08409390f chore: Fix post-submit coverage image. 2024-01-29 22:56:31 +00:00
iphydf 39aadf8922 fix: Don't use memcmp to compare IP_Ports.
`memcmp` compares padding bytes as well, which may be arbitrary or
uninitialised.
2024-01-29 13:58:45 +00:00
jfreegman d94246a906 fix: partially fix a bug that prevented group part messages from
sending.

When a peer leaves a group, they send a packet to the group
indicating that they're leaving. However if this packet is sent
via TCP, it gets put in a packet queue, which is then destroyed
on the rest of the group cleanup process before ever being able
to send.

This pr allows do_gc() to finish an iteration before cleaning the
group up, which allows the TCP packet queue to be emptied. However
this bug still exists on a tox_kill() event because we don't have
a chance to do another do_gc() iteration.
2024-01-27 12:27:27 -05:00
iphydf eeaa039222 chore: Fix rpm build; add a CI check for it. 2024-01-26 23:38:48 +00:00
iphydf 8328449c1a chore: Speed up docker builds a bit by reducing layer count.
This is especially noticeable on local builds (less so on the github
workers).
2024-01-26 14:13:34 +00:00
iphydf d6d67d56f3 cleanup: Add const where possible in auto tests.
Also one in `DHT_bootstrap.c`.
2024-01-25 23:17:32 +00:00
iphydf 6aa9e6850d cleanup: Minor cleanup of event unpack code. 2024-01-25 21:52:45 +00:00
iphydf bdf460a3a9 refactor: Rename system_{memory,...} to os_{memory,...}.
This rename happens in the system PR, so I'm pulling it out to reduce
the size of that PR.
2024-01-25 21:33:52 +00:00
jfreegman 203e1af81e fix: a few off by one errors in group autotests
Since we're nul terminating these buffers they need one extra byte
2024-01-25 11:08:35 -05:00
iphydf 5c093c4888 cleanup: Remove all uses of SIZEOF_VLA.
This is step 1 towards removing VLAs altogether.
2024-01-25 07:40:41 +00:00
iphydf 662c2140f3 test: Add goblint static analyser. 2024-01-24 23:31:00 +00:00
iphydf 8f07755834 cleanup: Use memzero(x, s) instead of memset(x, 0, s).
It's clearer and doesn't risk having a non-zero filler value.
2024-01-24 19:14:32 +00:00
iphydf a7258e40cf cleanup: Use explicit 0 instead of PACKET_ID_PADDING.
Calling it a packet ID is a lie, and we'd rather "memzero" than memset
with some named value that happens to be 0.
2024-01-24 12:21:55 +00:00
iphydf 6370d0f15d cleanup: Expand the Tox_Options accessor macros.
Macros should be avoided as much as possible.
2024-01-24 10:20:48 +00:00
iphydf 14a1a0b9bd cleanup: Remove plan9 support.
We really don't support it. I tried for half an hour to get some kind of
plan9 cross compilation to work, but it's not working. If anyone wants
to bring it back, they are welcome to send a PR including a CI check for
it. Until then, these 5 lines of unused code are gone.
2024-01-24 10:09:39 +00:00
iphydf a05dccad13 test: Add a simple new/delete test for Tox.
This can be used for some static analysis that doesn't currently survive
a full iterate loop, but can possibly survive a new+kill.
2024-01-24 08:58:03 +00:00
iphydf 1cdcf938b9 cleanup: Add comment after every #endif.
This makes far-away endifs clearer, so we're applying the rule to all
endifs to be consistent.
2024-01-23 21:52:41 +00:00
iphydf ba99d4dc4b test: Fix comment I broke in the events test PR. 2024-01-19 00:04:07 +00:00
Green Sky e07248debb refactor: Migrate auto_tests to new events API.
Co-authored-by: Green Sky <green@g-s.xyz>
2024-01-18 18:08:07 +00:00
iphydf bdd42b5452 refactor: Add common msgpack array packer with callback.
There will be more object arrays that need to be packed. This function
takes care of NULL (creating an empty array), and putting the correct
array size and calling the per-element callback the right amount of
times.
2024-01-18 13:52:35 +00:00
iphydf 3c659f5288 cleanup: Rename group to conference in groupav documentation. 2024-01-18 13:12:32 +00:00
iphydf 89957be230 cleanup: Ensure handler params are named after callback params. 2024-01-18 10:55:31 +00:00
iphydf c650d9d345 refactor: Pass this pointer as first param to s11n callbacks. 2024-01-17 13:11:14 +00:00
iphydf e7fb91ddb8 refactor: Allow NULL pointers for byte arrays in events.
Some events, notably the file chunk recv one, can give NULL pointers to
the client. Not sure they should, but that's what happens, so we support
it.
2024-01-17 09:13:07 +00:00
jfreegman 5e2c8cabc1 cleanup: make some improvements to group moderation test
- We no longer assert peer roles in the mod event callback
because this causes an issue with the new events implementation,
which triggers the events after all the packets from the
current tox_iterate() are processed, rather than as the
packets are received. These checks were superfluous and shouldn't
reduce code coverage.
- A moderator now sets the topic before the founder kicks him in
order to increase internal code coverage.
2024-01-16 18:08:11 -05:00
iphydf 259de4867e cleanup: Remove bin_pack_{new,free}.
We should only ever use `bin_pack_obj` and friends, which stack-allocate
the packer and pass it to callbacks.
2024-01-16 19:18:45 +00:00
jfreegman 21a8ff5895 cleanup: skip a do_gc iteration before removing peers marked for deletion
This fixes an issue with events where we try to make queries on peers
that no longer exist internally
2024-01-16 13:11:52 -05:00
iphydf 16809dc36e feat: Add dht_get_nodes_response event to the events system.
Should probably rename it to something starting with `debug_` and make
it opt-in. Right now, it absolutely spams the events object.
2024-01-16 10:52:31 +00:00
iphydf e2c01e457b refactor: Use enum-specific pack functions for enum values.
It's more obvious this way.
2024-01-15 21:47:13 +00:00
iphydf afc472402b refactor: Factor out union pack switch from event packer.
Preparation for it being generated.
2024-01-15 19:21:19 +00:00
iphydf 6caa7ce4b1 cleanup: Move the 2-element array pack out of individual events.
It's common across all events. No need to repeat it.

Co-authored-by: Green Sky <green@g-s.xyz>
2024-01-15 19:04:45 +00:00
iphydf 687af81f20 cleanup: Remove empty test doing nothing.
It's no longer needed since NGC was merged.
2024-01-15 18:29:08 +00:00
iphydf fcf5882428 test: Add printf log statement to group_moderation_test. 2024-01-15 18:09:38 +00:00
iphydf b4d8826228 cleanup: Remove old type-ordered event getters.
These are quite expensive, because they go through all events to index
in a typed array that no longer exists. Clients should index in the
union array and find the event they want themselves, or use dispatch.
2024-01-15 17:29:43 +00:00
Green Sky 8c35e0fefb feat: add ngc events 2024-01-15 16:32:10 +00:00