summaryrefslogtreecommitdiff
path: root/toxcore
AgeCommit message (Collapse)Author
2018-08-27try ipv6 connections even after udp timeoutzugz (tox)
Also adds a test (auto_reconnect_test) which fails without this change.
2018-08-27Make `ip_is_lan` return bool instead of 0/-1.iphydf
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`.
2018-08-26Use `bool` in place of 0/1 int values.iphydf
2018-08-26Add support for setting a custom monotonic time function in mono_timezugz (tox)
2018-08-26Format crypto_core.c.iphydf
Changes: * 100 columns maximum (not strict, can be a bit more sometimes). * No space after cast.
2018-08-26Update copyright to 2018.iphydf
2018-08-26Fix test class name for mono_time_test.iphydf
Was: Util, should be: MonoTime.
2018-08-26Add some tests for `ping_array`.iphydf
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.
2018-08-25Change while-loop to for-loop to express for-each-frame.iphydf
* Assignments can't be used as expressions, therefore `while` loops should not be used as a `for-each` construct. Use `for`, instead.
2018-08-25fix leave callback calling in del_groupchatzugz (tox)
2018-08-23Force storing the result of crypto_memcmp in the test.iphydf
So we don't accidentally elide the call given that it's a pure function and its result isn't used.
2018-08-21consistently use 'mono_time' rather than 'monotime'zugz (tox)
2018-08-19make Mono_Time an argument to current_time_monotoniczugz (tox)
2018-08-16Use per-instance `Mono_Time` for Messenger and onion.iphydf
2018-08-16Reduce the number of times `unix_time_update` is called.iphydf
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.
2018-08-16Release 0.2.6Robin Lindén
2018-08-13Avoid implicit conversion of negative value to uint32_t.iphydf
2018-08-13Avoid passing -1 as friend connection to new groups.iphydf
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.
2018-08-12Make `conferences_object` properly typed.iphydf
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.
2018-08-12add callback for successful connection to a conferencezugz (tox)
2018-08-12Remove last use of the `MIN` macro.iphydf
We use functions for this instead.
2018-08-11Add deprecation notice to some UPPER_CASE enums.iphydf
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.
2018-08-11Split out conference type (text/av) from identifier.iphydf
2018-08-10Use the crypto random functions instead of `rand()`.iphydf
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()`.
2018-08-09Fix typo in loop over assocs.zugz (tox)
2018-08-08Release 0.2.5Robin Lindén
2018-08-04Fix error message in m_send_generic_messageendoffile78
2018-08-04Remove unused `m_callback_log` function.iphydf
The logger callback can only be set once at the beginning, because it requires user data coming from `Tox_Options`.
2018-08-04Make a separate `struct Tox` containing the Messenger.iphydf
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.
2018-08-04Avoid multiple for-next expressions.iphydf
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)`).
2018-08-02Fix problems with initial connections and name-setting in conferenceszugz
* test names in conference_test * raise error on attempt to invite friend to group before we are connected * revise handling of temporary invited connections We are now careful not to prematurely delete a connection to a peer established during the invitation process; namely, before we have sufficient other connections and have confirmed that we have an alternative route to the peer. * process out-of-order messages from a peer * don't reset names when handling a Peer Response
2018-07-28Add `by_id` and `get_id` functions, renaming from `*_uid`.iphydf
`UID` sounds like `User ID`. While it is a Unique ID, the property of an "identifier" is generally that it identifies a unique thing, so the 'U' is redundant, and `GUID` as a globally unique id (which is likely also true for these IDs) has a specific meaning and syntax, so we're not using that. So, we just say conference `id`.
2018-07-22Run Clang global static analysis on Travis.iphydf
This uses a single .cc file containing almost all the code in the repository to perform whole program analysis.
2018-07-21Synchronise parameter names in headers with those in the implementation.iphydf
2018-07-21Reduce nesting by doing more early returns on error.iphydf
This almost entirely avoids any else-after-return in toxcore. One case is left, and that one is more readable this way. Why no else after return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return Why exemptions exist: https://blog.mozilla.org/nnethercote/2009/08/31/no-else-after-return-considered-harmful/
2018-07-21Make `resize` in `list.c` return bool instead of 0/1.iphydf
2018-07-20Release v0.2.4Robin Lindén
2018-07-19Introduce several TODOsJan Malakhovski
2018-07-19Rename `m_handle_custom_lossy_packet -> m_handle_lossy_packet`Jan Malakhovski
This function handles all lossy packets, including AV.
2018-07-19Collect `PACKET_ID*` constants in `net_crypto.h`, cleanup their usesJan Malakhovski
2018-07-19Link -lsocket and -lnsl for socket functions on Solaris.iphydf
Also, added some #defines to make symbols visible that are in BSD but not in UNIX. Solaris needs these, since it's fairly strict with its symbol visibility in system headers.
2018-07-18replace LOGGER_ERROR with LOGGER_DEBUG on send_data_packet() failure in ↵zugz
send_lossless_packet()
2018-07-18Use enums for group packet types.iphydf
Also moved some macros up to the beginning of `group.c`. This change brings us closer to the PGC PR.
2018-07-18Correct the max hostname length constant.iphydf
256 bytes including NUL byte is confusing and makes for really annoying bindings to other languages that don't account for NUL bytes in their string length. We pass C strings, not byte arrays, for hostnames, so 255 makes more sense here.
2018-07-16Set `_XOPEN_SOURCE` to 700 for FreeBSD.iphydf
2018-07-15Set C++11/C99 flag manually in older cmake on not-msvc.iphydf
These flags are needed so the code actually compiles, so can't only be set on Travis.
2018-07-13Add conference_by_uid and conference_get_uid functions.iphydf
These are useful once we have persistent group chats, so clients can store data associated with this permanent group identifier.
2018-07-12Limit number of group chats to 65536.iphydf
By changing numchats from uint32_t to uint16_t. This is done in PGC. This PR is making that change in master to reduce the diff in the PGC branch. Also: * Inverted groupnumber_not_valid and renamed to is_groupnumber_valid. * Renamed realloc_groupchats to realloc_conferences and made it return bool. * Added setup_conference function that currently just zeroes the conference structure but later will initialise more values. * Made some `i` iterator variables local to the for-loop using for-init-decl. This is also done in PGC.
2018-07-12Use named function types for group callbacks.iphydf
Also some other cleanups. This PR means that future PRs, i.e. the PGC PR, must not break the rules established here.
2018-07-12Style fixes in TCP code; remove MIN and PAIR from util.h.iphydf
* 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.