summaryrefslogtreecommitdiff
path: root/toxcore/tox.c
AgeCommit message (Collapse)Author
2020-05-05refactor: Disallow multiple initialised declarators per decl.iphydf
We no longer allow: ```c int a = 0, b = 0; int a[3], b[3]; int a, *b; ``` But we do still allow (for now): ```c int a, b; ```
2020-05-02Fix errors on error paths found by oomer.iphydf
* 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.
2020-04-16Add new semi-private API functions to set per-packet-id custom handlers.zoff99
This is to prepare for ToxAV becoming independent of toxcore internal calls.
2020-04-07Remove newlines from the end of LOGGER format strings.iphydf
See https://github.com/TokTok/hs-tokstyle/pull/49 for the corresponding tokstyle analysis.
2020-03-14Standardise on having a comma at the end of enums.iphydf
Most of our enums already have one. Some didn't. Tokstyle is going to require commas at the end of enumerator lists in enum definitions.
2020-03-14Use spdx license identifier instead of GPL blurb.iphydf
2020-03-11Add a mutex lock/unlock inside every public API function.iphydf
2020-03-08Pass packet ID to custom packet handlers.iphydf
We don't expose this to the user code, yet, because it would break the API, but this is useful for future internal code.
2019-05-19add configurable limit on number of stored frozen peerszugz (tox)
2019-01-12Add some const qualifierszugz (tox)
(Implementing suggestions of sudden6)
2019-01-05Expose offline conference peers in APIzugz (tox)
2018-11-29Implement conferences savingzugz (tox)
* add global friend_connection status callback, used for group rejoining * stop leaving groups on killing tox
2018-10-20Make saving and loading the responsibility of Tox rather than Messengerzugz (tox)
2018-10-19Add `LOGGER_ASSERT` for checking fatal error conditions.iphydf
These are not compiled out under `NDEBUG` and should be provably correct.
2018-09-10Assert that we don't kill tox before killing toxav.iphydf
Possibly this is what's happening in #1149.
2018-09-06Ignore "unused-result" warning in super_donators code.iphydf
2018-08-26Update copyright to 2018.iphydf
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-13Avoid implicit conversion of negative value to uint32_t.iphydf
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-11Split out conference type (text/av) from identifier.iphydf
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-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-19Introduce several TODOsJan Malakhovski
2018-07-19Collect `PACKET_ID*` constants in `net_crypto.h`, cleanup their usesJan Malakhovski
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-09Factor out time keeping code into its own module: mono_time.c.iphydf
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 ```
2018-07-05Make tox.c unambiguously parseable.iphydf
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
2018-06-26Make arg `host` understand clearly.cotox
Rename args `host:port` from `address:port`. The *address* is well known as *Tox Address* in this project. Then we should reserve *addres* to it, and use *host* to express the hostname or IP address in TCP domain.
2018-06-23Make NULL options behave the same as default options.iphydf
I.e. make tox_new(0, 0) behave the same as tox_new(tox_options_new(0), 0). Changing defaults in the options does not currently affect NULL options.
2018-05-20Finish @Diadlo's network Family abstraction.iphydf
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.
2018-05-20Move system header includes from network.h to network.ciphydf
2018-02-27Remove deprecated conference namelist change callback.iphydf
2018-02-24Fix a bunch of compiler warnings and remove suppressions.iphydf
2018-02-20Make the "persistent conference" callback changes new functions.iphydf
We can now revert the changes to the callbacks and keep supporting them until clients have moved off them.
2018-02-20make groupnumber uint32_tsudden6
fixes #606
2018-02-02Revert "Add correction message type"Diadlo
This reverts commit e16d3894c5979fcfe1c57bf7dadc455ce690baf9 and commit c5976e37eaadf663dc3d0c18376ea023355048f3.
2018-01-30Use nullptr as NULL pointer constant instead of NULL or 0.iphydf
This changes only code, no string literals or comments.
2018-01-20Add correction support for conferenceDiadlo
Fix #704
2018-01-16Make DHT a module-private type.iphydf
2018-01-16Make Net_Crypto a module-private type.iphydf
2018-01-14Make Friend_Requests a module-private type.iphydf
2018-01-11Move Networking_Core struct into the .c file.iphydf
To make it an abstract type everywhere except in network.c.
2018-01-10Fix formatting in some C files.iphydf
Also replace &(x) with &x for consistency.
2017-08-24Add platform independent constantsDiadlo
2017-08-24AF_INET -> TOX_AF_INETDiadlo