toxcore/auto_tests
iphydf dd8a568141
Make self_connection_status callback stateless.
**What are we doing?**

We are moving towards stateless callbacks. This means that when registering a
callback, you no longer pass a user data pointer. Instead, you pass a user data
pointer to tox_iterate. This pointer is threaded through the code, passed to
each callback. The callback can modify the data pointed at. An extra indirection
will be needed if the pointer itself can change.

**Why?**

Currently, callbacks are registered with a user data pointer. This means the
library has N pointers for N different callbacks. These pointers need to be
managed by the client code. Managing the lifetime of the pointee can be
difficult. In C++, it takes special effort to ensure that the lifetime of user
data extends at least beyond the lifetime of the Tox instance. For other
languages, the situation is much worse. Java and other garbage collected
languages may move objects in memory, so the pointers are not stable. Tox4j goes
through a lot of effort to make the Java/Scala user experience a pleasant one by
keeping a global array of Tox+userdata on the C++ side, and communicating via
protobufs. A Haskell FFI would have to do similarly complex tricks.

Stateless callbacks ensure that a user data pointer only needs to live during a
single function call. This means that the user code (or language runtime) can
move the data around at will, as long as it sets the new location in the
callback.

**How?**

We are doing this change one callback at a time. After each callback, we ensure
that everything still works as expected. This means the toxcore change will
require 15 Pull Requests.
2016-08-17 14:57:20 +01:00
..
assoc_test.c Removed a useless define. 2015-08-07 20:53:53 -04:00
crypto_test.c Realised there was no test to test these functions. 2016-01-30 21:56:54 -05:00
dht_test.c Test fix. 2016-01-04 22:59:29 -05:00
encryptsave_test.c Silence/fix some compiler warnings. 2016-08-10 13:52:40 +01:00
friends_test.c Friend request callback now contains the Tox object. 2014-03-16 13:24:39 -04:00
helpers.h Merge branch 'remove-sort_list' of https://github.com/pyruvate/toxcore 2014-08-09 17:35:23 -04:00
Makefile.inc Add and use CMake build script 2016-08-12 01:13:11 +01:00
messenger_test.c Changed gramatically incorrect comment in messenger_test 2015-10-23 22:54:22 +02:00
network_test.c Move argument comments to the end of line 2016-02-27 14:32:49 -05:00
onion_test.c Onion test fixed to work with faster DHT. 2015-12-15 14:58:36 -05:00
skeleton_test.c Remove DEFTESTCASE and DEFTESTCASE_SLOW redefinitions 2014-08-09 11:33:20 +03:00
TCP_test.c fix: compare sensitive data with sodium_memcmp 2016-01-27 02:14:59 +03:00
tox_test.c Make self_connection_status callback stateless. 2016-08-17 14:57:20 +01:00
toxav_basic_test.c Make self_connection_status callback stateless. 2016-08-17 14:57:20 +01:00
toxav_many_test.c Make self_connection_status callback stateless. 2016-08-17 14:57:20 +01:00