Commit Graph

80 Commits

Author SHA1 Message Date
irungentoo a26ced5fcb Merge branch 'master' into TCP 2014-05-08 18:26:01 -04:00
irungentoo 89022326d3 Fixed major denial of service issue. 2014-05-08 18:07:51 -04:00
irungentoo 4dc0af61c6 All time in core is now monotonic. 2014-05-03 11:58:45 -04:00
irungentoo deb8bfc350 Random number functions belong in crypto_core. 2014-05-01 19:42:44 -04:00
irungentoo 09aa97f712 Fixed issue. 2014-04-25 17:31:04 -04:00
Steven Noonan ecf0ff3e7f sockets: support Mac OS X way of disabling SIGPIPE on a socket
Mac OS X doesn't have MSG_NOSIGNAL, so we need to use SO_NOSIGPIPE.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2014-04-13 04:01:38 -07:00
irungentoo bd0d24fc9c Added TCP_client.
Some work done on the TCP part.
2014-04-06 20:51:03 -04:00
irungentoo c8ab29632b Some code cleanups. 2014-04-02 18:02:53 -04:00
irungentoo 5770a0e29a Merge branch 'api-fix'
Main changes:
1. Strings no longer need to be NULL terminated.
2. tox_get_friend_id is now named tox_get_friend_number.
3. The friend request callback function is now (Tox *tox, uint8_t *,
uint8_t *, uint16_t, void *), the Tox object pointer has been added to
it.
2014-03-18 20:02:50 -04:00
irungentoo 5babb281c0 Friend request callback now contains the Tox object. 2014-03-16 13:24:39 -04:00
irungentoo e95494482f A bit of work done on the TCP relay server. 2014-03-15 22:11:36 -04:00
Kelong Cong a13de8b105 updated compilation and execution instructions for Lossless UDP tests, and fixed minor typos 2014-03-12 21:40:52 +00:00
Maxim Biro e118319467 Some tox_wait_* improvements 2014-03-07 22:40:00 -05:00
Jin^eLD 4cd3d91263 Allow to optionally use randombytes_stir() instead of sodium_init()
According to sonOfRa sodium_init() has some timing issues on Android.
libsodium people said randombytes_stir() can be used instead:
https://github.com/jedisct1/libsodium/issues/121

sodium_init() stays the default, randombytes_stir() can be enabled by
passing --enable-randombytes-stir to the configure script.
2014-02-25 23:40:42 +01:00
irungentoo 80f001e03b Fixed possible memory leak. 2014-02-10 06:44:45 -05:00
irungentoo 5da80263a5 Convert IPv4 in IPv6 to IPv6 address in recieve packet. 2014-01-30 13:59:10 -05:00
benwaffle 0a9377d526 Update network.c 2014-01-20 00:27:01 -05:00
Ben Iofel 174cec7f15 proper windows preprocessor detection 2014-01-19 19:30:14 -05:00
irungentoo 6cd1e7fb70 Tests added and some fixes for the onion part. 2014-01-05 19:22:38 -05:00
irungentoo 24974ef816 Code cleanups.
No functionality changed.
2013-12-15 18:57:10 -05:00
irungentoo 08890a2004 Fixed arm bug. 2013-12-12 11:26:19 -05:00
irungentoo 5e4f3ce07f Add sodium_init() function to startup. 2013-11-29 12:57:31 -05:00
Coren[m] 26fef7cf9a Various changes to nTox including a potential crash (also possible from remote!), and a tiny change to toxcore.
Crash stuff:

nTox.c:
- do_refresh(): avoid crashes (input a "%" and the client goes "boom!", send someone a string with embedded "%" and see him blow up...)

Other stuff:

toxcore: tox.h (doc.)/network.c (code):
- networking_wait_prepare(): return -1 if lenptr was NULL and therefore not settable

nTox.c:
- fraddr_to_str(): function to convert a TOX_FRIEND_ADDRESS into a segmented (and therefore line-breakable) string
- print_friendlist(): print index of friend on name line, print id on 2nd line
- command /f: skip spaces (and +) inside a friend id
- command /r (new): "/r #" to remove a friend
- main(): reduce cpu consumption if we're not currently sending files
2013-11-27 21:00:23 +01:00
irungentoo a82ad576a2 Fixed build error on windows. 2013-11-16 21:21:32 -05:00
irungentoo bbef18ab4e Update time before running functions for recieved packets. 2013-10-25 14:55:46 -04:00
irungentoo 9303c18b0c Merge branch 'Cleanup-defines' of https://github.com/FullName/ProjectTox-Core into FullName-Cleanup-defines 2013-10-20 15:12:46 -04:00
Coren[m] a0f08839bd Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then always off).
Additionally (besides cleanups):

network.h/tox.h:
- WIN32: fix a strange sa_family_t definition
- WIN32: define EWOULDBLOCK to WSAEWOULDBLOCK
- WIN32: kill macro for an existing function (IN6_ADDR_EQUAL)

network.c:
- use EWOULDBLOCK instead of EAGAIN (same value, but EWOULDBLOCK is more "popular")
- new_networking(): only try to enable IPv4-in-IPv6 if it's not already enabled per default
- inet_ntop()/inet_pton(): WIN32: remove partial initializers in favor of a simple memset()
- ip_equal(): WIN32: use an existing function
- logging: networking_wait_execute(): only dump result if not timeout
- logging: loglogdata(): kill an unused variable

LAN_discovery.c:
- send_broadcasts(): re-enabled, can only support IPv4 by principle, split into fetch_broadcast_info() (to fetch the addresses once) and send_broadcasts() (actual sending)

DHT.c:
- DHT_load_state_callback(): enclosed a fprintf(stderr, ...) into #ifdef DEBUG

Lossless_UDP.c:
- change_handshake(): harden against strange sa_family_t definitions

Messenger.c:
- logging: fix ID to string conversion

util.c:
- logging: eliminate a signed-warning
2013-10-20 16:56:12 +02:00
Antonio Montes 3df81b07f3 fixed build errors on windows 2013-10-19 11:14:03 -07:00
irungentoo dc1c019a2d Small fix. 2013-10-13 10:43:53 -04:00
mannol 5bc2560904 tox A/V: integration of A/V code into tox
Also-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
2013-10-13 16:40:15 +02:00
naxuroqa a60ffa9591 fix for missing EAGAIN definition on windows 2013-10-09 10:49:27 +02:00
Coren[m] 355c55f745 sendqueue_length no longer determines if we check for socket-can-write, but sendpacket() sets a timestamp if it happened
network.*:
- sendpacket(): checks result and on EAGAIN, stores time of this event
- networking_wait_prepare(): uses the time if set to check up to 500ms later for the socket to be writeable again
- networking_wait_cleanup(): clears the time if the socket was writeable
- fixed some accidental tabs

Messenger.*, tox.*:
- pass-through functions to reach networking_wait_cleanup()
- fixed some accidental tabs
2013-10-06 16:37:02 +02:00
Coren[m] 1331a32223 Broken *_wait() into *_wait_prepare() and *_wait_execute()
To allow the actual waiting to run without any locking, split it into preparing the data it uses and the execution of the wait.
The caller must provide with the buffer to store whatever data it requires to wait.
Completely eliminates any reliance on the existence of anything but that data in the actual wait routine.

Also fixed a few argument type warnings inside LOGGING.
2013-10-05 12:53:54 +02:00
Coren[m] 1f92ee274d Only add write-ready to select() if we have packets queued
Lossless_UDP.*:
- sendqueue_total() sums sendqueue() across all connections

network.*, Messenger.c:
- sendqueue_total() is collected and then used in deciding if we select() on write-readiness
2013-10-03 12:10:29 +02:00
Coren[m] 2af0d43ce8 Add tox_wait() for socket, allow tox.h include in tox.c
tox.*, Messenger.*, network.*;
- new function tox_wait() => waitMessenger() => networking_wait():
  - waits for a given amount of time for any sort of socket activity
  - mustn't change anything inside, mustn't poll or do other stuff
    - the point is to be able to call this asynchronously from a second thread
    - the outside shall follow up with an immediate tox_do() when there's socket activity

tox.*:
- allow inclusion of tox.h into tox.c, ensuring that the outside interface and the internal always match

util.c:
- squished a few warnings about questionable format strings
2013-10-02 16:38:54 +02:00
irungentoo bb6566e436 Astyled network.c 2013-09-22 14:37:04 -04:00
BtbN a7eb9b2c34 Fix inet_pton/ntop on win32 2013-09-22 20:26:39 +02:00
BtbN b9306d6d06 Fix compilation on windows for ipv6 code 2013-09-21 01:10:23 +02:00
irungentoo 524af7ef07 Increased the size of the UDP buffers. 2013-09-20 08:25:01 -04:00
Coren[m] 88e80dc88f Allow loginit() to be delayed, store loglog() data in intermediate buffer and flush it out when loginit() is called
util.c:
- handle loglog() before loginit() by storing the lines into an expanding buffer
- when loginit() is called, write out and kill the buffer

network.c:
- push loginit() to the point where we know the actually used port
2013-09-18 16:25:55 +02:00
irungentoo 1d2f4465bf Toxcore should never print anything when built normally. 2013-09-16 11:22:01 -04:00
Coren[m] ab2805a23b Fix warnings of -Wall -Wextra 2013-09-16 10:37:22 +02:00
Coren[m] ee1cc34d55 Fix in ip_equal, plus testing code which led to that fix...
network.c:
- use the correct macro for IPv4-in-IPv6 test

network_test.c:
- bunch of tests for addr_resolve() and ip_equal()
2013-09-15 23:39:09 +02:00
irungentoo decdb7aa8c more portability fixes. 2013-09-15 10:17:09 -04:00
irungentoo 43b609d41c Fixed merge problems. 2013-09-15 09:35:46 -04:00
irungentoo fca574a0e0 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-15 09:31:46 -04:00
irungentoo 8c41244627 Fixed portablity problems.
struct in6_addr member names can differ per platform.
2013-09-15 09:31:27 -04:00
Coren[m] 16a6c9fb59 Merge remote-tracking branch 'upstream/master' into Integration 2013-09-15 08:54:14 +02:00
Coren[m] 1e1782a952 ip_equal(): handle embedded v4 vs. native v4 as equal
network.c:
- ip_equal(): on IPv4 vs. IPv6, check if the IPv6 is an embedded IPv4 and if true, compare that
2013-09-15 08:33:09 +02:00
Coren[m] 2092b5d936 addr_resolve() rewrite broke { (ipv6enabled == true) name => IPv4 address }
network.c:
- addr_resolve(): save AF_UNSPEC ip4 address into ip4, not into to->ip4
2013-09-15 08:20:37 +02:00