Commit Graph

3979 Commits

Author SHA1 Message Date
iphydf
aa0e3974c5
Add TODO for @mannol. 2016-09-05 22:44:06 +01:00
isotoxin
2c989d992c Rearrange fields to decrease size of structure 2016-09-03 21:26:45 +03:00
iphydf
33edad8582
Add a short sleep before each tox_iterate in av test.
A race condition that happens on machines with heavily used network interfaces
causes tests to fail. Packets sent don't arrive on time. This sleep gives it 100
extra milliseconds. The real fix would be to wait for the event to occur and
then continue, but with a "once-loop" that is tox_iterate, it's not feasible at
this time.
2016-09-02 22:02:22 +01:00
iphydf
a759ddc7eb
Re-enable group chat tests.
They don't seem to be a lot less stable than the rest. Either way we regularly
need to restart builds to make timeouts go away.
2016-09-02 13:57:46 +01:00
iphydf
a9fbdaf46b
Do not use else after return.
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-02 11:02:56 +01:00
iphydf
6f42eadc54
Replace pthread_yield with sched_yield.
The former is a non-standard glibc extension. On linux, it is implemented as a
call to sched_yield, so this change does nothing there. On OSX, pthread_yield
doesn't exist, and we already use sched_yield.
2016-09-02 09:55:00 +01:00
iphydf
579bdc126f
Remove useless casts.
These casts are either completely useless (casting T to T) or implicit (x = y).
2016-09-01 18:49:49 +01:00
iphydf
77db27331e
Sort #includes in all source files. 2016-09-01 16:35:46 +01:00
iphydf
ad13518153
Add missing #include <pthread.h> to av_test.c.
It was an undefined function before.
2016-09-01 15:22:03 +01:00
iphydf
45d1f9acb9
Match parameter names in declarations with their definitions.
The parameter names were taken from function definitions to update the names in
function declarations (prototypes).
2016-09-01 14:54:17 +01:00
iphydf
576f130615
Remove redundant return statements. 2016-08-31 23:51:39 +01:00
iphydf
3a9300368d
Add newlines because astyle wants them.
We'll revert this once we move to clang-format.
2016-08-31 20:54:20 +01:00
iphydf
633da98ae6
Add braces to all if statements. 2016-08-31 20:04:16 +01:00
iphydf
6356eb4e4f
Enable build of av_test.
It has not been built in a while. We do want to keep this one working (or at
least compiling).
2016-08-31 20:02:41 +01:00
iphydf
8595d47e10
Remove unused and bit-rotten friends_test. 2016-08-31 18:11:44 +01:00
iphydf
fa3b51266b
Add missing #includes to headers and rename tox_old to tox_group.
Also, no longer #include the group code into tox.c. Instead, compile it
separately in tox_group.c. This is a bit less surprising to someone looking
around the code. Having some implementations in a .h file is certainly a bit
surprising to a disciplined C programmer, especially when there is no technical
reason to do it.
2016-08-30 19:31:40 +01:00
iphydf
4692cea75e
Add getters/setters for options. 2016-08-29 23:15:39 +01:00
iphydf
74ecb0c460
Update tox.h with constant functions.
These are now generated by apidsl.
2016-08-29 14:07:17 +01:00
iphydf
8e0eeff79f
Expose constants as functions.
These functions simply return the constants. They are a stable ABI, so that if
constants change, the ABI of these functions won't. Code solely relying on these
functions will remain compatible with future values of those constants.

The functions are currently not exposed in tox.h, because this is pending a
change in apidsl to generate accessors for "const" values.
2016-08-28 20:05:07 +01:00
iphydf
13ae9e9a93
Move logging to a callback.
This removes the global logger (which by the way was deleted when the first tox
was killed, so other toxes would then stop logging). Various bits of the code
now carry a logger or pass it around. It's a bit less transparent now, but now
there is no need to have a global logger, and clients can decide what to log and
where.
2016-08-27 01:16:14 +01:00
mannol
1f25fc0ae4 Fix plane size calculation in test 2016-08-26 22:47:19 +02:00
iphydf
a45356ce3e
Avoid large stack allocations on thread stacks.
OS X and Windows have small thread stacks by default. Allocating audio and video
frames (about 962KB total) on the stack overflows it.
2016-08-26 21:17:24 +01:00
iphydf
eb8a3e7a7c
Comment out useless TODO'd if block.
The condition is a potential use after free, because `connection_kill` before it
will delete the `conn` that is dereferenced.
2016-08-26 20:45:29 +01:00
iphydf
a3f9893e89
Initialise the id in assoc_test.
Once every new moon, the assoc_test would fail because the key is 0. It
can be anything but 0 to succeed, so I made it 1.
2016-08-26 15:24:43 +01:00
Gregory Mullen (grayhatter)
8c8532a984
Reduce the timeout on travis to something much more reasonable
10x timeouts forces travis to kill our build without offering anything helpful
2016-08-25 11:52:46 -07:00
iphydf
7075c3648a
Add cmake test for apidsl. 2016-08-24 09:41:40 +01:00
iphydf
503d198741
Replace uint with unsigned int in assoc.c.
uint is not a valid type on Windows. It's also not a valid type in C, but Linux
and OSX define it somewhere. We can't rely on its existence.
2016-08-22 16:01:08 +01:00
Gregory Mullen (grayhatter)
a6f2e9539b
Make Message received receipts stateless 2016-08-22 03:12:47 -07:00
Gregory Mullen (grayhatter)
3f0c101771
Make Friend User Status stateless 2016-08-22 02:10:18 -07:00
iphydf
b044cfbf15
Fix windows build.
The threading networking functions (on windows: winsock and friends) need to be
linked into the toxnetwork library, not the toxcore library, anymore. On Linux
and OSX, there is no winsock. On OSX, there is no need to link against threading
libraries, and on Linux, toxnetwork can have unresolved symbols when linking, so
this failure wasn't caught before.

Tested by building on the iphydf/windows-x86-qt5 docker image.
2016-08-21 14:21:57 +01:00
Zetok Zalbavar
4d83451da6
docs(INSTALL.md): update instructions for Gentoo 2016-08-20 19:44:50 +01:00
Gregory Mullen (grayhatter)
1f94c96266
Make the friend message callback stateless 2016-08-20 11:07:49 -07:00
Felix Salfelder
1fa5887fee add missing header to dist tarball 2016-08-20 16:30:59 +01:00
iphydf
f9c83c1084
Build assoc DHT code on travis. 2016-08-20 00:59:22 +01:00
iphydf
c597f67012
Add format-source script.
This is easier to use from a precommit hook, so it can be used to ensure that
all formatting is correct before committing code.
2016-08-20 00:39:18 +01:00
Gregory Mullen (grayhatter)
0e18966a27
Make Typing change callback stateless
Moved a few #defines to the top of the header for better readability
2016-08-19 16:13:23 -07:00
iphydf
83d4857f08
Fix operation sequencing in TCP_test.
The expression was fun(foo = bar, foo). The evaluation order is unspecified,
and often this will do the wrong thing. We should forbid side effects in
argument lists and conditionals.
2016-08-19 19:46:23 +01:00
iphydf
bdf5ac37b4
Make friend_status_message callback stateless.
See #40 for details.
2016-08-18 17:19:23 +01:00
iphydf
6935643f9a
Fix some compiler warnings. 2016-08-18 17:10:15 +01:00
iphydf
390fcb6c27
Allow NULL as argument to tox_kill.
This behaviour is consistent with free() and operator delete.
2016-08-18 16:37:58 +01:00
iphydf
a5e35180c7
Make tox_callback_friend_name stateless.
See #27 and #40 for details.
2016-08-18 00:01:53 +01:00
iphydf
db22522741
Add missing DHT_bootstrap to CMakeLists.txt.
- This PR also adds a DEBUG cmake option that enables -DTOX_DEBUG.
- We also remove `-Wall`, because there are too many warnings, and nobody really
  looks at them at the moment. We'll see about fixing them soon. We'll also want
  to enable `-Werror` at some point.
- Finally, this PR enables `-O3` to make sure toxcore still works correctly
  under heavy compiler optimisations.
2016-08-17 22:12:39 +01:00
iphydf
2fc5449870
Try searching for libsodium with pkg-config in ./configure.
If libsodium can't be found with PKG_CHECK_MODULES, try AC_CHECK_LIB. If that
also fails, abort configure. If a user passes --with-libsodium-libs explicitly,
that overrides the pkg-config found location.
2016-08-17 21:28:44 +01:00
iphydf
c603c8c9e7
Merge remote-tracking branch 'irungentoo/master' 2016-08-17 20:52:10 +01:00
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
iphydf
cebf64a588
Split toxcore into layers.
This allows us to more clearly define interfaces between modules, and have the
linker help us ensure that module boundaries are respected.

The onion/tcp/net_crypto layer is a bit too large. This is due to a cyclic
dependency (onion -> net_crypto -> TCP -> onion). We may or may not want to
break that cycle in the future to allow the onion library to exist on its own
without net_crypto.
2016-08-16 17:36:18 +01:00
Gregory Mullen (grayhatter)
e43bde37ea
Update readme with tentative roadmap, removed old todo.md 2016-08-14 12:03:26 -07:00
iphydf
35932b5381
Add "make install" step to Travis build. 2016-08-12 20:49:50 +02:00
iphydf
11de2c222f
Build tox-bootstrapd in the cmake build. 2016-08-12 01:58:23 +01:00
iphydf
f7324f997b
Only report coverage on clang, not on the GCC build. 2016-08-12 01:54:42 +01:00