Age | Commit message (Collapse) | Author |
|
|
|
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.
|
|
* 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.
|
|
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.
|
|
|
|
Also changed their return type to bool instead of 1/0 ints.
|
|
|
|
This is to prepare for ToxAV becoming independent of toxcore internal calls.
|
|
See https://github.com/TokTok/hs-tokstyle/pull/49 for the corresponding
tokstyle analysis.
|
|
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.
|
|
|
|
We don't expose this to the user code, yet, because it would break the
API, but this is useful for future internal code.
|
|
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).
|
|
- 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
|
|
|
|
|
|
|
|
|
|
This is for modules like groups to hook into to have their own state
management in the `tox_savedata` format.
|
|
|
|
|
|
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.
|
|
|
|
|
|
The logger callback can only be set once at the beginning, because it
requires user data coming from `Tox_Options`.
|
|
This allows Tox to contain additional data on top of Messenger, making
Messenger not necessarily the most top-level object. E.g. groups are
built on Messenger and currently awkwardly void-pointered into it to
pretend there is no cyclic dependency.
|
|
All for-loops in toxcore are of the form
for (<for-init>; <for-cond>; <for-next>) { <body> }
`for-init` can be a variable declaration (like `int i = 0`), an
assignment (like `i = 0`), or empty.
`for-cond` can be any expression.
`for-next` can be an assignment or a single increment/decrement
expression (like `++i` or `--i`).
No other forms are allowed, so e.g. comma expressions in any of these are
not allowed (so no `for (i = 0, j = n; ...; ++i, --j)`).
|
|
|
|
This function handles all lossy packets, including AV.
|
|
|
|
* Moved PAIR to toxav, where it's used (but really this should die).
* Replace most MIN calls with typed `min_*` calls. Didn't replace the
ones where the desired semantics are unclear. Moved the MIN macro to
the one place where it's still used.
* Avoid assignments in `while` loops. Instead, factored out the loop body
into a separate `bool`-returning function.
* Use named types for callbacks (`_cb` types).
* Avoid assignments in `if` conditions.
* Removed `MAKE_REALLOC` and expanded its two calls. We can't have
templates in C, and this fake templating is ugly and hard to analyse
and debug (it expands on a single line).
* Moved epoll system include to the .c file, out of the .h file.
* Avoid assignments in expressions (`a = b = c;`).
* Avoid multiple declarators per struct member declaration.
* Fix naming inconsistencies.
* Replace `net_to_host` macro with function.
|
|
It turns out, `unix_time` is also monotonic, and is used as such, so I've
renamed the new functions to `mono_time_*`.
2018-07-08:
```
00:01 <@irungentoo> the idea used to be that the unix_time() function
could go backward in time but I think I might have started using it like
if it could not after I changed it so that it would never go back in time
```
|
|
|
|
`BS_LIST` would be a constant. `BS_List` is a type name.
|
|
Rules:
1. Constants are uppercase names: THE_CONSTANT.
2. SUE[1] types start with an uppercase letter and have at least one
lowercase letter in it: The_Type, THE_Type.
3. Function types end in "_cb": tox_friend_connection_cb.
4. Variable and function names are all lowercase: the_function.
This makes it easier for humans reading the code to determine what an
identifier means. I'm not convinced by the enum type name change, but I
don't know a better rule. Currently, a lot of enum types are spelled like
constants, which is confusing.
[1] struct/union/enum
|
|
|
|
Currently, toxcore does not support UDP over proxies. In the future, we
can relax this by disabling UDP only if the proxy doesn't support it.
|
|
The Family stuff in toxcore is a big mess. I'm sure I saw a bunch of bugs
on the way, but I'm not verifying that code now, so the bugs stay.
|
|
|
|
|
|
|
|
By increasing a magic number.. Also, added more verbose logging to the
file transfer test.
|
|
|
|
DETECTED=cppcheck
|
|
Found using the infer static analyser.
https://github.com/facebook/infer
DETECTED=infer
|
|
Instead of 1 FT blocking all others.
|
|
|
|
This reverts commit e16d3894c5979fcfe1c57bf7dadc455ce690baf9 and
commit c5976e37eaadf663dc3d0c18376ea023355048f3.
|
|
This changes only code, no string literals or comments.
|
|
https://www.freebsd.org/cgi/man.cgi?alloca
If stdlib.h does not define alloca, and we're using GCC (or Clang), we
define the macro ourselves in terms of a GCC builtin.
|