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
irungentoo
836daa9e95
Added save/load live test.
2015-06-12 23:05:37 -04:00
irungentoo
81d95809fd
Test fix.
2015-06-07 20:56:02 -04:00
irungentoo
f4d0b85284
Save DHT nodes in a smarter way.
2015-06-06 22:13:43 -04:00
irungentoo
bf90c63c27
Added test.
2015-06-05 22:11:19 -04:00
mannol
d694839d60
Rebased on master and removed alpha channel (again)
2015-06-05 22:14:37 +02:00
irungentoo
5196aa82ca
Added test.
2015-06-04 22:18:09 -04:00
irungentoo
17f7376581
Add a test for loading with a secret key.
2015-06-01 20:16:03 -04:00
irungentoo
3f6a8f10bb
Allow empty keys in toxencryptsave.
2015-05-27 19:54:04 -04:00
irungentoo
8e80ced6ce
Move savedata to options struct.
...
Add a way to select the type of savedata (normal savedata, load a
secret key, potentially others?) to load.
2015-05-22 18:23:56 -04:00
mannol
3100042a2b
Updated with master
2015-05-22 23:22:31 +02:00
irungentoo
2ba076ac5c
Load only secret key from tox save, not public key.
...
Calculate public key from it.
2015-05-21 20:39:47 -04:00
irungentoo
815725ab84
Some fixes.
2015-05-19 19:55:43 -04:00
irungentoo
40f113c077
Added tcp test.
2015-05-14 21:07:29 -04:00
irungentoo
478552d338
Fixes and changes to tox_bootstrap and tox_add_tcp_relay.
...
Functionality of both no longer overlaps.
If address has more than 1 ip, call the internal function on all of them.
2015-05-11 12:41:53 -04:00
irungentoo
3a28a8c5fb
Added basic TCP server hosting to tox.h api.
...
TODO: tell friends we are hosting a relay and prioritize using relays
hosted by friends over bootstrap ones.
2015-05-08 22:03:24 -04:00
mannol
73fbc22961
Fixed inconsistencies
2015-05-07 23:14:03 +02:00
mannol
eb6e8aa290
Fixed* api comments and some bugs
2015-05-01 22:29:25 +02:00
mannol
b2b11f0fba
Added many test and fixed various warnings
2015-04-30 00:40:30 +02:00
mannol
9bba7a0434
Done
2015-04-29 01:01:25 +02:00
irungentoo
c3a6c5b92e
Small change to TCP test.
2015-04-08 20:50:19 -04:00
irungentoo
cf436fde12
Fixed onion test.
2015-04-06 15:57:23 -04:00
Dubslow
f7beee495e
Make keys into a struct for more programmer safety
2015-03-31 21:16:04 -05:00
Dubslow
9b66c57bd0
Fix minor code duplication
2015-03-31 19:30:09 -05:00
irungentoo
99e0fde297
Merge branch 'master' of https://github.com/dubslow/toxcore
2015-03-31 19:44:51 -04:00
Dubslow
e998aca8f7
Fix toxencryptsave to be consistent with new_api
...
Upon my own decision, the two tox_encryped_new convenience functions were removed due to basically needing two different sets of error codes.
At iphydf's suggestion the corresponding tox_get_encrypted_savedata convenience functions were removed as well.
2015-03-31 18:31:23 -05:00
irungentoo
06b389ea5e
Making tox_encrypted_new() use the same error codes as tox_new was a bad idea.
...
They now have their own error codes.
2015-03-26 12:39:09 -04:00
irungentoo
b0983104d5
Renamed tox_file_send_control to tox_file_control.
...
Renamed tox_file_send_seek to tox_file_seek.
2015-03-21 08:58:54 -04:00
irungentoo
8c2347222a
Transfers with filelength == 0 now behave exactly like transfers of every
...
other size (except streaming of course).
2015-03-21 08:35:31 -04:00
irungentoo
f2a017c055
Allow sending of file transfer requests with length 0 but don't allocate
...
any file number for them in core.
These can be used to tell friends we don't have an avatar set or to unset
a set avatar.
2015-03-20 21:15:44 -04:00
irungentoo
b1ec157175
For file transfers UINT64_MAX is now used as the size for streaming
...
transfers instead of 0.
For avatar transfers file size 0 now means that the client has no avatar
set.
Added a test for streaming transfers.
2015-03-20 20:12:07 -04:00
Dubslow
d8da9bf709
callback_file_request_chunk -> callback_file_chunk_request
...
A couple of minor reasons, combined warrant a PR imo:
a) fileChunkRequested is a better signal name than fileRequestChunkReceived, and I don't want to break consistency by reordering words for just this signal
b) "request chunk" is parsed by English speakers as a verb-object combination,
implying sending the request, not receiving, whereas "chunk requested" is
parsed (more correctly) as an adjective-noun combo (in particular, request is
a noun not a verb), and thus reads far more like "hey heads up we just got a request"
For instance some tests/testing code had some callbacks to *receive* chunk requests, and they were called "tox_file_request_chunk"... to receive a chunk, not request it. Now they're called "tox_file_chunk_request".
So yeah...
2015-03-19 08:38:27 -05:00
irungentoo
e0bd6ef4e0
Renamed TOX_MESSAGE_TYPE_MESSAGE to TOX_MESSAGE_TYPE_NORMAL.
2015-03-18 17:14:57 -04:00
irungentoo
45cf8a744c
Merge branch 'one_more_rename' of https://github.com/dubslow/toxcore into new_api
2015-03-18 16:15:36 -04:00
irungentoo
d711362622
Merged normal message function and send action function into one
...
messaging function.
This removes code duplication and allows us to easily add new message
types to the api without having to add new functions.
2015-03-18 15:32:53 -04:00
Dubslow
2f65de6fd1
Move get_connection_status to self pseudonamespace, to contrast friend_get_connection_status
2015-03-18 14:18:36 -05:00
irungentoo
5b7cbc8956
Api changes.
...
receive to recv in file receive functions.
Added TOX_MAX_FILENAME_LENGTH define.
2015-03-18 12:54:00 -04:00
irungentoo
8286c2c22f
Save function renamed to tox_get_savedata()
2015-03-17 16:20:38 -04:00
irungentoo
ea8d27259f
Added tox_file_send_seek() function to api.
...
This function can be used to seek an incoming file tranfer right
before accepting it.
It is meant to be used to resume incomplete file tranfers by clients.
2015-03-17 15:05:17 -04:00
irungentoo
24c70c9e84
Added and implemented file_id parameter to file tranfers.
...
file_id is a 32byte identifier that can be used by users to identify
file tranfers across core/client restarts in order to resume broken
file tranfers.
In avatar tranfers it corresponds to the hash of the avatar.
Added tox_file_get_file_id() function to api to obtain the file_id
of an ongoing file transfer.
If not set, core will generate a random one.
2015-03-17 13:44:48 -04:00
iphydf
fa7c21f95c
New API fixups.
2015-03-16 13:12:25 +00:00
irungentoo
29857a3da4
This belongs in the previous commit.
2015-03-13 16:33:55 -04:00
irungentoo
8e2957ec50
Merge branch 'newer_api' of https://github.com/dubslow/toxcore into new_api
2015-03-13 15:29:34 -04:00
Dubslow
64fefb6f43
revert to TOX_FILE_KIND
2015-03-13 12:34:14 -05:00
Dubslow
3bf259f69d
Convert core code depending on the api
2015-03-12 18:23:14 -05:00
irungentoo
334cb9c8db
Check more ports in tox_test.c
2015-03-12 19:04:49 -04:00
irungentoo
8dc2db2025
Added position parameter to tox_file_send_chunk().
...
This is done so that the function now has the same parameters as the
request chunk callback.
2015-03-12 15:17:34 -04:00
irungentoo
7afab000f7
tox_new now sets error to TOX_ERR_NEW_PORT_ALLOC when binding to port fails.
2015-03-12 13:03:14 -04:00
irungentoo
1eca7b8e67
Added simple status message test to tox_test.c
2015-03-12 12:18:52 -04:00
irungentoo
43fe6e71bd
tox_callback_connection_status() implemented.
...
Attempted fix of connection checking to make it more stable.
2015-03-11 15:37:25 -04:00
irungentoo
88a8a079b6
Implemented the 3 low level network information functions.
...
Added tox_get_udp_port() to tests.
2015-03-11 08:09:45 -04:00
irungentoo
0207fcdfb0
Implementation of new api file transfers.
...
Everything should work except resuming.
2015-03-10 17:31:50 -04:00
irungentoo
36c3a270fd
Properly fixed encryptsave_test.c
2015-03-01 20:31:55 -05:00
irungentoo
680c7c2ecd
Merge branch 'new_api' of https://github.com/dubslow/toxcore into new_api
2015-03-01 20:14:01 -05:00
Dubslow
2d3077904e
Update encryption autotest
2015-02-28 12:55:40 -06:00
irungentoo
d015879cd3
Test fixes.
2015-02-27 20:33:43 -05:00
irungentoo
e61e2919a9
More tests ported to new api.
2015-02-26 08:24:19 -05:00
irungentoo
76dfccf2d6
Ported some tests to the new api.
2015-02-25 21:09:14 -05:00
irungentoo
78ea33b3f0
Fixed test.
2015-02-08 17:34:49 -05:00
irungentoo
23d76f484a
Fixed memory leak in test.
2015-02-08 16:30:48 -05:00
irungentoo
d9ea6e9485
Properly free everything at the end of each test.
2015-02-07 22:57:04 -05:00
irungentoo
f463cb52a2
Code cleanups.
...
Rename array in Node_format from client_id to public_key.
2015-01-29 19:38:44 -05:00
irungentoo
dd59d99a7a
Fixed bug in tox_load where names of size TOX_MAX_NAME_LENGTH didn't
...
load.
2014-12-21 22:12:12 -05:00
irungentoo
d1eb793a9c
auto test group titles.
2014-12-20 23:12:43 -05:00
irungentoo
82ba83e526
cs_set_video_encoder_resolution improvements.
2014-12-16 13:10:28 -05:00
irungentoo
d6da08fe9d
Fixed test.
2014-12-15 19:04:56 -05:00
irungentoo
015a8b7d75
Sendback data size is always 8 bytes.
2014-12-14 20:33:31 -05:00
irungentoo
6f3312c137
More group auto testing.
2014-12-13 21:56:36 -05:00
irungentoo
36851e7b38
Test if everything goes well when a peer leaves the group chat.
2014-12-11 20:10:57 -05:00
irungentoo
4eeeb8e9ab
Added a tox_add_friend auto test.
2014-12-10 12:12:37 -05:00
irungentoo
4ec9295259
Fixed tox_test.c
2014-12-09 18:13:39 -05:00
irungentoo
7d27893f1a
Merge branch 'more_consistent_custom_packet_handlers' of https://github.com/wrouesnel/toxcore
2014-12-09 16:39:52 -05:00
Will Rouesnel
d595a28b49
Patch auto_tests/tox_test.c with the new prototype
2014-12-09 11:00:24 +11:00
irungentoo
422f228921
Test now works with large groups.
2014-12-05 22:37:02 -05:00
irungentoo
5112156953
Added basic group message test.
2014-12-05 21:39:46 -05:00
irungentoo
035cd7ece3
Added simple group auto test.
2014-12-04 20:54:59 -05:00
mannol
e62ded3a6d
More av cleanup
2014-11-29 13:42:19 +01:00
irungentoo
767c0653bd
Attempted fix of threading issue in test.
2014-11-27 21:08:01 -05:00
irungentoo
89f2436fac
Astyle autotests.
2014-11-25 15:31:46 -05:00
irungentoo
279c33c01a
Merge branch 'master' of https://github.com/mannol/toxcore
2014-11-24 20:24:59 -05:00
irungentoo
6bbb939855
Cleaned up packet length types in toxcore.
...
They are now all uint16_t instead of sometimes being uint32_t.
Replaced some other uint32_t with unsigned ints.
2014-11-21 20:18:29 -05:00
mannol
386c9748d4
av refactor
2014-11-18 00:46:46 +01:00
dubslow
d90ee9d4e4
fix #1124 by adding salt manip functions
...
Also, all data now has the magic number prepended. This is incompatible
for all but the save/load functions, but I think nothing besides the one
experimental qTox branch used any of those, which is why I feel confident
about the change.
2014-10-23 04:19:18 -05:00
dubslow
ff1d4faa74
add new test cases, cleanup astray printf
2014-10-17 09:23:21 -05:00
dubslow
ffb13e4716
add load/save from key instead of pw
2014-10-17 06:02:15 -05:00
dubslow
e6f30694d3
refactor toxencryptedsave to allow passphrase encryption of arbitrary data
...
also a minor API change for clarity
2014-10-08 18:50:40 -05:00
dubslow
eee37b5767
fix #1104
2014-10-07 21:53:04 -05:00
irungentoo
f2a313359e
Added callbacks to onion_client and net_crypto for the temp dht key.
...
Better than the polling mess.
Moved DHT to Messenger from onion_client (still needs some cleanups).
2014-09-26 20:32:38 -04:00
irungentoo
939f2003ef
Removed now useless network sturct size tests.
2014-09-26 18:01:03 -04:00
irungentoo
900d72f951
Fixed test.
2014-09-21 15:15:35 -04:00
irungentoo
c43526be9c
Fixed memory leak.
2014-09-21 14:55:23 -04:00
dubslow
579e7998b7
encrypted save fully work with both libsodium and nacl
...
they both reliably pass "make check"
2014-09-12 21:15:05 -05:00
Dubslow
c26c6d86ae
memzero() segfaulted for unknown reasons... probably pebkac...
2014-09-11 22:42:22 -05:00
Dubslow
26566666aa
testing works, but doesn't pass...
2014-09-11 21:28:50 -05:00
irungentoo
a0302b7aca
Added tests for custom lossy and lossless packets.
...
Fixed bug with lossless packets.
2014-09-08 12:20:44 -04:00
irungentoo
06eff4b44b
Increased number of friends tested in tox_test.
2014-09-04 20:54:55 -04:00
irungentoo
ef78169842
Added disabling of UDP and basic SOCKS5 proxy support to public API.
...
tox_new() now takes a Tox_Options struct as argument.
If a NULL pointer is passed to that struct, defaults are used.
2014-08-14 18:34:20 -04:00
irungentoo
1298932deb
UDP can now be disabled.
...
new_messenger() now takes an options struct as an argument.
2014-08-14 15:27:34 -04:00
irungentoo
78dd2234e0
Added basic socks5 proxy support to TCP client.
2014-08-14 14:31:26 -04:00
irungentoo
bc4fe2c80d
Decreased maximum onion_test test time.
2014-08-13 10:15:25 -04:00
irungentoo
f6955f2f3e
Merge branch 'remove-sort_list' of https://github.com/pyruvate/toxcore
2014-08-09 17:35:23 -04:00
pyruvate
354f08ec3b
Tests fix for an original behavior for duplicates
2014-08-09 13:31:40 +03:00
pyruvate
bdf1c97273
Refactoring of node replacements in addto_lists function
...
An index for replacement candidate is searched
in one lookup cycle for all types (bad, possibly bad, good).
Sorting of items has been removed (sorting logic can be substituted
by a maximum search).
2014-08-09 11:33:20 +03:00