Commit Graph

13 Commits

Author SHA1 Message Date
iphydf 2f87ac67b0 feat: Add Event Loop abstraction (Ev).
- `Ev` interface in `toxcore/ev.h` and `toxcore/ev.c`.
- System-specific event loop backends (epoll, poll, win32) in
  `toxcore/os_event.c`.

Performance Benchmarks (epoll backend):

| Sockets (N) | Active (M) | Time (ns) | Time/Active (ns) |
|------------:|-----------:|----------:|-----------------:|
|           8 |          1 |       438 |              438 |
|          64 |          1 |       438 |              438 |
|         512 |          1 |       443 |              443 |
|        1024 |          1 |       442 |              442 |
|        1024 |         10 |       947 |               95 |
|        1024 |        100 |     6,268 |               63 |
|        1024 |       1024 |    61,875 |               60 |
2026-01-19 17:49:39 +00:00
iphydf 4962bdbb80 test: Improve TCP simulation and add tests
- `FakeTcpSocket` handles basic TCP state machine (SYN, ACK, RST, buffering).
- `NetworkUniverse` handles TCP routing and loopback.
- Add `TcpRelayChaining` test.
- Add LogFilter to Simulation.
2026-01-17 14:35:20 +00:00
iphydf dd31362509 cleanup: Apply nullability qualifiers to C++ codebase. 2026-01-15 12:19:00 +00:00
iphydf 1849f70fca refactor: Extract low-level networking code to net and os_network.
Move core networking types and the Network interface to net, and the
standard OS socket implementation to os_network. Update network to use
these new abstractions.
2026-01-14 23:44:18 +00:00
iphydf 8fec754218 refactor: Delete tox_random, align on rng and os_random. 2026-01-14 15:15:40 +00:00
iphydf a03ae8051e refactor: Delete tox_memory, align on mem and os_memory.
os_memory will be os_mem later.
2026-01-14 10:19:05 +00:00
iphydf 4c88fed2c9 refactor: Use std:: prefixes more consistently in C++ code. 2026-01-14 02:10:10 +00:00
iphydf 72452f2aeb test: Add some more tests for onion and shared key cache.
Also some other cleanups.
2026-01-13 23:43:56 +00:00
iphydf b6f5b9fc56 test: Add some benchmarks for various high level things. 2026-01-12 14:37:27 +00:00
iphydf 8a8d02785e test(support): Introduce threaded Tox runner and simulation barrier
- Add `MpscQueue` for thread-safe task scheduling.
- Add `ToxRunner` to execute Tox instances in dedicated threads.
- Update `Simulation` to coordinate time steps across multiple runners using a synchronization barrier.
- Refactor `FakeMemory` and `FakeClock` to be thread-safe.
- Update `tox_network` helpers and tests to utilize the threaded runner infrastructure.
2026-01-11 22:51:59 +00:00
iphydf 4f6d4546b2 test: Improve the fake network library.
Some bugfixes, and getting ready for benchmark support code.
2026-01-11 12:32:44 +00:00
iphydf 695b6417aa test: Add some more simulated network support.
We'll need this for future tests (coming soon).
2026-01-08 18:50:34 +00:00
iphydf 9c22e79cc8 test(support): add SimulatedEnvironment for deterministic testing
Introduces a new testing support library 'testing/support' that provides
a clean, modular, and fully deterministic environment for testing
toxcore components.
2026-01-07 13:06:18 +00:00