Commit Graph

3800 Commits

Author SHA1 Message Date
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
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
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
iphydf
8339e3449f
Run hstox test suite against toxcore on Travis. 2016-08-12 00:22:09 +01:00
iphydf
50921070ce
Move toxcore travis build scripts out of .travis.yml.
This is in preparation for having multiple types of build. One of the future
builds will be a hstox build, another may be frama-c or some other static
analyser. It makes sense to split these up into multiple builds, because each of
them can take a while, and running them in parallel will speed things up. Also,
the hstox test coverage should be reported separately from the toxcore auto_test
coverage.
2016-08-12 00:07:05 +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
5d26ce1cf5
Fix a bug I introduced that would make toxcore fail to initialise a second time.
sodium_init returns 1 when the library was already initialised. Toxcore code
wasn't prepared to handle sodium errors, so it thought it was an allocation
error.

This error is still not handled correctly. If crypto fails to initialise, it
will think it's an allocation error. Fixing this requires too many code changes,
so must be done later.
2016-08-11 18:14:54 +01: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
irungentoo
755f084e87
Merge branch 'update-sysvinit-docs' of https://github.com/LittleVulpix/toxcore 2016-07-27 11:59:58 -04:00
iphydf
131522c335
Merge remote-tracking branch 'littlevulpix/patch-1' 2016-07-12 11:00:05 +01:00
LittleVulpix
4e9f29af42 Merge branch 'master' into patch-1 2016-07-12 11:53:26 +02:00
Gregory Mullen (grayhatter)
fa85dd15f2
minor fixes to main readme
Requested, suggested
2016-07-12 02:11:01 -07:00
Gregory Mullen (grayhatter)
b03c8fdda9
Do the coverage thing too... 2016-07-11 14:19:11 -07:00
Gregory Mullen (grayhatter)
903c39f8e8
Change and move Bulid status icon 2016-07-11 13:56:50 -07:00
LittleVulpix
88f29aaa9f Documentation: SysVInit workaround for <1024 ports
Update the manual to provide a command necessary to open <1024 ports for users on SysVinit
2016-07-11 11:34:32 +02:00
LittleVulpix
98446e0818 Documentation: SysVInit workaround for <1024 ports
Update the manual to provide a command necessary to open <1024 ports for users on SysVinit
2016-07-10 22:56:00 +02:00
iphydf
7dab0400a8
Enable toxcore logging when building on Travis.
The logging code is rarely tested by users, so we use Travis to exercise it.
2016-07-07 20:53:49 +01:00
iphydf
83f525886a
Start recording test coverage and move to ubuntu precise.
- We use coveralls.io to report on test coverage and avoid getting below a
  certain threshold. The threshold is currently 60%, but we will be increasing
  it when it stabilises.
- We use gcc/clang -ftest-coverage and gcov to measure C test coverage.
- We switched to container based Travis build infrastructure, which has the
  advantage of faster boot times[1] (1-6s vs. 20-52s). The trusty beta supports
  caching, but the longer boot times make it an unattractive target.
- We now need to build more dependencies ourselves and cache the result. We
  still fetch what we can (currently opam, libvpx, and check) from apt.

[1] https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments
2016-07-07 12:45:55 +02:00
iphydf
532435120a
Remove trailing whitespace from toxav.in.h. 2016-07-07 12:44:16 +02:00
iphydf
adc39b9ebd
Merge branch 'avswitch' of https://github.com/derivefh/toxcore 2016-07-07 12:42:58 +02:00
irungentoo
532629d486
Merge branch 'network-test-magic' of https://github.com/roman-yepishev/toxcore 2016-03-19 00:09:36 -04:00
irungentoo
aafeb7ddd8
Merge branch 'make-dist' of https://github.com/roman-yepishev/toxcore 2016-03-13 22:07:50 -04:00
derive
13fc00cc1b Added astyled toxav.h to match toxav.in.h 2016-03-09 15:52:31 +13:00
nobody
285dabdbc1 Updated to match current toxav.h 2016-03-09 01:22:15 +13:00
irungentoo
2e48a3f51d
Merge branch 'tox-bootstrapd-smaller-docker' of https://github.com/nurupo/InsertProjectNameHere 2016-03-07 14:57:51 -05:00
irungentoo
c817b3334f
Merge branch 'nurupo-apidsl-check' 2016-03-07 14:56:50 -05:00
Maxim Biro
41046e2eef Added check of whether tox.h or toxav.h were edited directly
tox.h and toxav.h must be generated by apidsl instead of edited directly.
2016-03-07 14:35:09 -05:00
romik-g
c2b2142f33 Changes from @nurupo for build and runtime dependencies that reduce image size
Also removal of example bootstrap nodes from the config file in one line
2016-03-03 13:30:11 -05:00
romik-g
739975dc3d Re-format to reduce image file by 50% 2016-03-03 13:29:24 -05:00
irungentoo
c510e2407f
Merge branch 'master' of https://github.com/susnux/toxcore into susnux-master 2016-03-01 15:17:00 -05:00