Commit Graph

63 Commits

Author SHA1 Message Date
Gregory Mullen (grayhatter)
21f8db12c4
Make ToxAV stateless 2016-09-17 14:05:51 -07:00
iphydf
1494e474dd
Ensure that all TODOs have an owner.
In the future, all TODOs added either need a bug number (TODO(#NN)) or a
person's github user name. By default, I made irungentoo the owner of
all toxcore TODOs, mannol the owner of toxav TODOs, and myself the owner
of API TODOs.
2016-09-16 12:06:02 +01:00
iphydf
ad26560516
Improve static and const correctness.
- Any non-externally-visible declarations should be `static`.
- Casting away the `const` qualifier from pointers-to-const is
  dangerous. All but one instance of this are now correct. The one
  instance where we can't keep `const` is one where toxav code actually
  writes to a chunk of memory marked as `const`. This code also assumes
  4 byte alignment of data packets. I don't know whether that is a valid
  assumption, but it's likely unportable, and *not* obviously correct.
- Replaced empty parameter lists with `(void)` to avoid passing
  parameters to it. Empty parameter lists are old style declarations for
  unknown number and type of arguments.
- Commented out (as `#if DHT_HARDENING` block) the hardening code that
  was never executed.
- Minor style fix: don't use `default` in enum-switches unless the number
  of enumerators in the default case is very large. In this case, it was
  2, so we want to list them both explicitly to be warned about missing
  one if we add one in the future.
- Removed the only two function declarations from nTox.h and put them
  into nTox.c. They are not used outside and nTox is not a library.
2016-09-06 11:54:37 +01:00
Gregory Mullen (grayhatter)
aad1e0ad3f
Make friend requests stateless
Messenger is slightly twisty when it comes to sending connection status
callbacks It will very likely need at the very least a partial refactor to
clean it up a bit. Toxcore shouldn't need void *userdata as deep as is
currently does.

(amend 1) Because of the nature of toxcore connection callbacks, I decided to
change this commit from statelessness for connections changes to statelessness
for friend requests. It's simpler this was and doesn't include doing anything
foolish in the time between commits.

group fixup because grayhatter doesn't want to do it

"arguably correct" is not how you write security sensitive code

Clear a compiler warning about types within a function.
2016-09-06 02:22:04 -07: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
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
77db27331e
Sort #includes in all source files. 2016-09-01 16:35:46 +01:00
iphydf
633da98ae6
Add braces to all if statements. 2016-08-31 20:04:16 +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
irungentoo
6a494e2cbd
Astyle. 2015-11-03 13:42:05 -05:00
Eniz Vukovic
d6fdf16520 New Adaptive BR algorithm, cleanups and fixes 2015-10-10 23:54:23 +02:00
mannol
7d5de68364 Fixed CALL_STATE naming 2015-07-10 16:54:53 +02:00
mannol
6c126e34e6 Implement handling capability change on rtp level 2015-06-30 01:41:38 +02: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
a3132feddb Fixed sample size in callback and other stuff 2015-06-13 15:00:34 +02:00
mannol
d694839d60 Rebased on master and removed alpha channel (again) 2015-06-05 22:14:37 +02: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
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
45cf8a744c
Merge branch 'one_more_rename' of https://github.com/dubslow/toxcore into new_api 2015-03-18 16:15:36 -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
Dubslow
3bf259f69d Convert core code depending on the api 2015-03-12 18:23:14 -05:00
irungentoo
76dfccf2d6
Ported some tests to the new api. 2015-02-25 21:09:14 -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
mannol
e62ded3a6d More av cleanup 2014-11-29 13:42:19 +01:00
irungentoo
279c33c01a
Merge branch 'master' of https://github.com/mannol/toxcore 2014-11-24 20:24:59 -05:00
mannol
386c9748d4 av refactor 2014-11-18 00:46:46 +01:00
pyruvate
ec9082f2c3 Remove DEFTESTCASE and DEFTESTCASE_SLOW redefinitions 2014-08-09 11:33:20 +03:00
irungentoo
0719a4296e
Merge branch 'mannol1-master' 2014-08-02 11:29:27 -04:00
mannol
6c1ac97da9 Added userdata pointer to audio/video callbacks 2014-08-02 01:09:33 +02:00
irungentoo
ab4673e873
Merge branch 'mannol1-master' 2014-07-26 21:26:32 -04:00
mannol
fc230c8671 Fixed tests and conflicts 2014-07-27 00:26:58 +02:00
mannol
54e7d29589 Make codec settings dynamic 2014-07-26 19:29:49 +02:00
irungentoo
6ede3e8ad4
Merge branch 'master' of https://github.com/mannol1/toxcore 2014-07-22 11:20:55 -04:00
mannol
0cf9f27b70 This should fix test failing 2014-07-21 22:11:59 +02:00
mannol
79115259a8 Fixed conflicts 2014-07-21 04:10:05 +02:00
mannol
1aeeef58b2 Improved protocol and cleaned code a bit 2014-07-21 01:10:57 +02:00
notsecure
c527979daa make autotests compile 2014-07-07 17:37:05 -04:00
irungentoo
65b4c026f4
The width and height set during the video encoder initialization is
now described as the maximum width and height of images.

This is to work around what appears to be a bug in libvpx where the
resolution of the stream can be decreased but increasing it above
its originally set value introduces memory corruption.
2014-07-05 14:36:19 -04:00
irungentoo
139cfa7aeb
Merge branch 'master' of https://github.com/mannol1/toxcore 2014-06-22 19:54:40 -04:00
mannol
6f46dd5afd Removed hamful code 2014-06-23 00:22:01 +02:00
irungentoo
2fa8815a85
Fixed some warnings. 2014-06-10 18:51:40 -04:00
irungentoo
9a4659e575
Replaced randombytes_salsa20_random_buf() with randombytes() in av tests. 2014-05-25 12:28:59 -04:00
irungentoo
82e38883a2
Merge branch 'mannol1-Multicalls' into multi-av 2014-05-25 12:27:48 -04:00
mannol
565e95301f Tests works and some fixes 2014-05-24 16:02:01 +02:00