Age | Commit message (Collapse) | Author |
|
|
|
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).
|
|
Also, use them in the `onion_client` module.
|
|
Using the full path including the repo name.
|
|
|
|
We use functions for this instead.
|
|
* 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
```
|
|
These are not used in a thread-safe way, but it opens the path towards
per-tox-instance time keeping and removal of some unsafe global state.
|
|
|
|
In preparation for adding log statements.
Also, fix an uninitialised variable warning in cppcheck.
|
|
Instead of 1 FT blocking all others.
|
|
|
|
"All rights reserved" was incorrect. The project was licensed under GPL3,
which means a lot of rights are licensed to everybody in the world, i.e.
not reserved to the "Tox Project".
|
|
These are cheap asserts. I've also replaced the fprintf's with
`LOGGER_ERROR` calls.
|
|
Cleanups:
- Fix header guards to not use reserved names.
- Avoid name shadowing.
- Removed an unused variable found by avoiding name shadowing.
|
|
Toxcore itself doesn't use this data structure. Only toxav does, so now
toxav owns the code for it.
|
|
This reverts commit 21f8db12c45bd56293262cd4abfb73cd9abec821.
It is currently broken. Incoming call callbacks are not invoked, and
instead the client goes offline immediately.
|
|
|
|
- Any non-externally-visible declarations should be `static`.
- Casting away the `const` qualifier from pointers-to-const is
dangerous. All but one instance of this are now correct. The one
instance where we can't keep `const` is one where toxav code actually
writes to a chunk of memory marked as `const`. This code also assumes
4 byte alignment of data packets. I don't know whether that is a valid
assumption, but it's likely unportable, and *not* obviously correct.
- Replaced empty parameter lists with `(void)` to avoid passing
parameters to it. Empty parameter lists are old style declarations for
unknown number and type of arguments.
- Commented out (as `#if DHT_HARDENING` block) the hardening code that
was never executed.
- Minor style fix: don't use `default` in enum-switches unless the number
of enumerators in the default case is very large. In this case, it was
2, so we want to list them both explicitly to be warned about missing
one if we add one in the future.
- Removed the only two function declarations from nTox.h and put them
into nTox.c. They are not used outside and nTox is not a library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Saves should now be portable from big endian to little endian systems
though I need someone to actually test it to be sure I didn't mess up.
|
|
Now we can also remove the helper routines from toxcore/util.[ch].
|
|
|
|
|
|
|
|
|
|
|
|
No functionality changed.
|
|
Also removed some old, useless loading code.
|
|
cleanup_unix_time_id_eq_cpy_is_timeout
Conflicts:
toxcore/net_crypto.c
|
|
|
|
unix_time():
- returns local value for current epoch
- value is updated explicitly with unix_time_update() called at new_DHT()/doMessenger()/do_DHT()
is_timeout():
- uses the local value for current epoch
id_cpy()/id_eq() => id_copy()/id_equal():
- centralized duplicate definitions
- replaced (most) memcpy()/memcmp() of (*, *, CLIENT_ID_SIZE) with id_copy()/id_equal()
|
|
|
|
Compilerflag: CLIENT_ONETOONE_IP (to define in DHT.h, default unset i.e. NEW case: two addresses)
Every function in DHT{_test}.c working on Client_data has been rewritten to store IPv4 addresses in assoc4, IPv6 addresses in assoc6.
Loading/Storing of states defined with other compiler switch is transparently adjusting to the differences.
DHT.h, DHT.c:
- introduction and handling of the structure changes
DHT_test.c, Messenger.c:
- logging adapted to new structures
util.h:
- LOGGING isn't undefined per default anymore
|
|
|
|
Conflicts:
toxcore/Messenger.c
toxcore/util.c
toxcore/util.h
|
|
65536) friends...
|
|
Primary rationale: The part that DHT saves changes if IP is expanded to IPv6. To let people keep their friends/name, change the datafile format now, while everybody is still on the same page.
Loading/Saving rewritten to allow a part of the file to be incomprehensible to the loading routine.
Added a magic cookie at the beginning to mark the file as tox's.
Changes in some part of the datafile can be skipped and the remaining parts still be consumed.
Allows a wide margin of forward compatibility (like the IP to IPv6 transition, but also e.g. a change in the key format).
As long as the file is not completely garbled, the routine will read as much as possible. Only the KEY section is considered mandatory: a malformed key section leads to a negative result.
util.*:
- holds the driving function which jumps from section to section and calls back with section length and tag (type)
Messenger.c,DHT.*:
- new loading functions call the util-function with a callback, which subsequently consumes the sections
- old routines are kept to fall back onto if the magic cookie at the beginning isn't present
- saving is still done in one local routine
|
|
- moved cmdline_parsefor_ipv46() to testing/misc_tools.c
|
|
|