Commit Graph

317 Commits

Author SHA1 Message Date
iphydf
633da98ae6
Add braces to all if statements. 2016-08-31 20:04:16 +01:00
iphydf
8595d47e10
Remove unused and bit-rotten friends_test. 2016-08-31 18:11:44 +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
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
Gregory Mullen (grayhatter)
1f94c96266
Make the friend message callback stateless 2016-08-20 11:07:49 -07: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
a5e35180c7
Make tox_callback_friend_name stateless.
See #27 and #40 for details.
2016-08-18 00:01:53 +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
b5cfd33340
Add and use CMake build script
Also, fix the hstox build that was taking half an hour. It now takes 5 minutes.
Also, perform distcheck on travis to ensure that make dist works. It's not
actually failing the build at the moment due to broken tests.
2016-08-12 01:13:11 +01:00
iphydf
459f8f2013
Check code formatting on Travis.
We run astyle on Travis and check if there is a diff. The build terminates if
git finds a difference.
2016-08-12 01:00:00 +01:00
Gregory Mullen (grayhatter)
6f3e689eeb
Fix a few issues with running Toxcore tests on Travis-CI
> increased the timeout for TCP tests because per @irungentoo the network on Travis-CI can be slow sometimes

> allowed groupchats test to restart on error until timeout This had to be done because current groupchats are fundamentally broken and 3/5 times they'll 'net-split' on connect

>> Drop group chat tests, add comment to the reason

> added some debugging information to TCP tests, and a #define to force IPV6 (Travis-CI only uses IPv4 on their containers) and decreased the itr interval

> Went crazy with timeouts for Tox network stuff on Travis. Tests on TCP will still randomly fail due to timeouts. I can't reproduce on any local system. So again per @irungentoo, Travis is slow, let's offer it a short bus.
2016-08-11 14:41:57 -07:00
iphydf
fc330c1fa5
Silence/fix some compiler warnings.
Some of these (like the incompatible pointers one) are really annoying for
later refactoring.
2016-08-10 13:52:40 +01:00
Roman Yepishev
c886f906a8
Move argument comments to the end of line 2016-02-27 14:32:49 -05:00
Roman Yepishev
32d86978fd
Remove unused main() arguments 2016-02-27 12:07:04 -05:00
Roman Yepishev
9035325e56
Remove magic numbers from addr_resolve
* Add #defines for INET/INET6 returns
* Remove magic number 3 - exact AF_INET/INET6 result found.
* Updated network_test.c
2016-02-27 11:45:02 -05:00
irungentoo
94cc8b11ff
Realised there was no test to test these functions. 2016-01-30 21:56:54 -05:00
irungentoo
dfe5d9b256
Fixes.
Fixed bug from merged PR.

Don't build useless files when building with libsodium.
2016-01-30 17:23:15 -05:00
Roman Proskuryakov
ed3a794c9b fix: compare sensitive data with sodium_memcmp
fix: make increment_nonce & increment_nonce_number independent of user-controlled input
	fix: make crypto_core more stable agains null ptr dereference
2016-01-27 02:14:59 +03:00
irungentoo
b9ef24875c
Test fix. 2016-01-04 22:59:29 -05:00
irungentoo
9a87f03aec
Onion test fixed to work with faster DHT. 2015-12-15 14:58:36 -05:00
irungentoo
2d93eb2048
Better DHT tests. 2015-12-11 17:50:36 -05:00
irungentoo
f40a60575f
Slightly increased number of peers to announce to.
Some test fixes.
2015-12-01 20:11:53 -05:00
irungentoo
6a494e2cbd
Astyle. 2015-11-03 13:42:05 -05:00
Soumitra
fc25ca11d1 Changed gramatically incorrect comment in messenger_test 2015-10-23 22:54:22 +02:00
Soumitra
21b45b8b74 Added ommited words in comment 2015-10-23 22:54:22 +02:00
Eniz Vukovic
e5ddc0af03 Test should not assert when hangup fails 2015-10-11 00:43:05 +02:00
Eniz Vukovic
d6fdf16520 New Adaptive BR algorithm, cleanups and fixes 2015-10-10 23:54:23 +02:00
mannol
c641b0fceb Updated with upstream 2015-08-09 12:39:21 +02:00
irungentoo
6cb8ff4d65
Removed a useless define. 2015-08-07 20:53:53 -04:00
irungentoo
dfc154cc9e
client_id -> public_key 2015-07-29 22:39:56 -04:00
mannol
7d5de68364 Fixed CALL_STATE naming 2015-07-10 16:54:53 +02:00
irungentoo
1d4552c3c4
Test oob responding too. 2015-07-06 22:20:18 -04:00
irungentoo
06f4e8d6b6
Added a TCP test for oob packets. 2015-07-05 23:08:14 -04:00
irungentoo
a5b71e4c86
Test fix. 2015-07-04 22:43:05 -04:00
irungentoo
c259250abb
Fixed Tox reporting itself as being connected with TCP when using UDP only on LAN. 2015-07-03 21:52:53 -04:00
irungentoo
750201c901
Added a couple of checks to test. 2015-07-02 21:59:52 -04:00
irungentoo
7a3ca5d4c5
Basic tcp connections test done. 2015-07-01 22:13:27 -04:00
irungentoo
97d6c4ba18
TCP connections test start. 2015-06-29 22:27:47 -04:00
mannol
6c126e34e6 Implement handling capability change on rtp level 2015-06-30 01:41:38 +02:00
irungentoo
50e0802a62
Removed useless parameter from new_TCP_server() 2015-06-28 22:14:54 -04:00
mannol
2ecb71bb1e Renamed TOXAV_CALL_STATE to TOXAV_FRIEND_CALL_STATE 2015-06-27 17:28:07 +02:00
mannol
08bc4eb0e0 Added payload turning off by setting bit rate to 0 2015-06-27 01:55:28 +02:00
mannol
f9f17fdf10 Merge remote-tracking branch 'upstream/master' into new_api 2015-06-25 00:58:23 +02:00
mannol
a3132feddb Fixed sample size in callback and other stuff 2015-06-13 15:00:34 +02:00