Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
No use making this a macro. LTO will inline this anyway, if we care about
performance. Generally, we avoid function-like macros that can be functions.
|
|
See https://github.com/TokTok/toktok-stack/pull/38.
|
|
This resets friend search rate in two circumstances where it should be
reset:
* When the friend gets a dhtpk packet to us;
* When a friend connection to the friend goes down.
|
|
This CI can run Bazel tests, because it supports IPv6. This is nice,
because now we can run IPv6 tests on every PR.
|
|
We were mistakenly not making a rejoin attempt on freezing connections
due to all closest connections going down. This fixes that, and tweaks
the test. I've still only done tens rather than hundreds of tests, but
I'm fairly confident that the conference test now consistently passes.
|
|
|
|
|
|
Using the full path including the repo name.
|
|
|
|
Possibly this is what's happening in #1149.
|
|
|
|
This is for modules like groups to hook into to have their own state
management in the `tox_savedata` format.
|
|
|
|
|
|
* add freezing and unfreezing of peers
* add rejoin packet
* revise handling of temporary invited connections
* rename "peer kill" packet to "peer leave" packet
* test rejoining in conference test
* use custom clock in conference test
|
|
This uses a trick to get read-write access to `this` from a `const`
member function, similar to C++ `mutable`, but uglier.
|
|
The raw clock isn't subject to NTP adjustments. It may run less
accurately than the regular monotonic clock. I see no reason why raw
would be better for tox than the normal one.
This avoids one piece of OS-specific ifdef'd code.
|
|
Can't trivially get rid of recursion here, since it's a non-linear
recursive function.
|
|
|
|
Also adds a test (auto_reconnect_test) which fails without this change.
|
|
This inverts the truthiness of the return value. Previously, 0 meant
`true` and -1 meant `false`. Now, `true` (1) means `true` and `false` (0)
means `false`.
|
|
|
|
|
|
Changes:
* 100 columns maximum (not strict, can be a bit more sometimes).
* No space after cast.
|
|
|
|
Was: Util, should be: MonoTime.
|
|
No timeout test here yet, because we don't yet have the ability to
manipulate time at will, so we would have to actually sleep.
|
|
* Assignments can't be used as expressions, therefore `while` loops
should not be used as a `for-each` construct. Use `for`, instead.
|
|
|
|
So we don't accidentally elide the call given that it's a pure function
and its result isn't used.
|
|
|
|
|
|
|
|
Reduced by, e.g.:
* `file_transfer_test`: 33% of the `clock_gettime` calls.
* `tox_many_test`: 53% of the `clock_gettime` calls.
Other tests will see similar improvements. Real world applications will
be closer to 40-50% improvement, since tox_many_test has 100 nodes, while
file_transfer_test has 2 nodes.
|
|
|
|
|
|
Somehow it still works because the lower levels can deal with
inconsistent/broken state, but this lets us avoid that broken state in
the first place. If a friend connection doesn't exist, we don't add it to
our group.
|
|
The void pointer here only adds opportunity to introduce bugs and doesn't
actually make things more layered. It's just the code lying about being
layered while it's actually spaghetti.
|
|
|
|
We use functions for this instead.
|
|
The enumerators won't change, but the type name will change in 0.3.0.
Reasoning:
- Type names in toxcore start with an uppercase letter and either have at
least one lowercase letter in them, or are less than 4 characters long.
- Constants consist of 4 or more uppercase letters or underscores.
By these rules, "DHT" is a type name, but "TOX_USER_STATUS" is a
constant. We provide Tox_User_Status as an alternative for now, and will
switch to that in 0.3.0, removing the UPPER_CASE versions.
|
|
|
|
Presumably the uses of `rand()` were fine because they were not used in
security-sensitive places, but having to think about whether a crappy RNG
is acceptable in each situation requires effort that could better be
spent elsewhere.
Also, this means that once we have a custom deterministic RNG for
testing, that RNG is used everywhere, so all the code is deterministic.
It also allowed us to delete a system-specific function that wasn't used
anywhere except in a call to `srand()`.
|
|
|
|
|
|
|
|
The logger callback can only be set once at the beginning, because it
requires user data coming from `Tox_Options`.
|