Age | Commit message (Collapse) | Author |
|
|
|
|
|
A way to send and handle lossy UDP packets coming from friends.
Will be used for A/V.
|
|
define DHT_SERVER_EXTRA_PACKETS to enable.
|
|
|
|
|
|
Plan 9 requires u.h in every file
|
|
|
|
|
|
Also added some tests.
|
|
No functionality changed.
|
|
AF_INET/AF_INET6 can vary across devices, we introduce TOX_AF_INET and
TOX_AF_INET6 to fix this.
|
|
|
|
|
|
Significantly trimmed down version of an ID<=>IP cache.
|
|
|
|
Besides acknowledging timeouts, the module isn't trying to do anything fancy with the data besides storing and retrieving.
|
|
Also removed some old, useless loading code.
|
|
|
|
|
|
unix_time():
- returns local value for current epoch
- value is updated explicitly with unix_time_update() called at new_DHT()/doMessenger()/do_DHT()
is_timeout():
- uses the local value for current epoch
id_cpy()/id_eq() => id_copy()/id_equal():
- centralized duplicate definitions
- replaced (most) memcpy()/memcmp() of (*, *, CLIENT_ID_SIZE) with id_copy()/id_equal()
|
|
|
|
|
|
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
|
|
|
|
Also-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
|
|
|
|
|
|
struct in6_addr member names can differ per platform.
|
|
|
|
Nonces don't need to be random, only different.
also random_int now gives same quality random numbers for both NaCl and
libsodium.
|
|
messages.
|
|
Conflicts resolved:
toxcore/Messenger.c
toxcore/network.h
|
|
- addr_resolv(_or_parse_ip)(): added an optional parameter to return both an IPv6 and an IPv4 address if requested address family was AF_UNSPEC
- logging of unhandled packets
DHT.c:
- bootstrap_from_address(): use the additional return from addr_resolv_or_parse_ip() to bootstrap in both network types at once
Lossless_UDP_testclient.c:
- main(): adapt to signature change of addr_resolve()
Messenger.c. LAN_discovery.h:
- lost a htons(), readded
- moved LAN_DISCOVERY_INTERVAL #define into LAN_discovery.h
LAN_discovery.c:
- added IPv4-in-IPv6 local address test
|
|
- #define'd tox's network port (as range)
- finally killed tox_new_ex() in favor of changing tox_new()'s signature
- renamed tox_bootstrap() to tox_bootstrap_from_ip()
network.h:
- #define'd tox's network port (as range)
- renamed SEND_NODES_EX to SEND_NODES_IPV6
- bind() loop uses #define'd port range
DHT.c:
- renamed SEND_NODES_EX to SEND_NODES_IPV6
- sending ipv6 node addresses even if can't use them ourselves
nTox.c:
- adapted to changed tox_new()
|
|
|
|
|
|
- added logging functions, default off
tox.h:
- added includes for sockaddr_in/6
network.c:
- added logging functions, default off (#define in util.h)
- IPv6: activating site-local all-nodes multicast address (i.e. IPv6 equivalent of broadcast)
|
|
|
|
- second set of *_bootstrap_ex() functions to allow addresses instead of IPs
network.h:
- new message ID for sending/receiving IPv6 nodes
DHT.*:
- get_close_nodes():
- additional parameter to select which kind of nodes: IPv4 or IPv6
- sendnodes()/handle_sendnodes():
- the IPv4 message must remain intact even when the Node_format structure (which embeds IP_Port) is expanded
- added Node4_format to keep the structure "alive"
- copying in/out of wider to smaller format required in sendnodes()/handle_sendnodes()
- switch of Node_format from Node4_format to Node46_format by define
|
|
|
|
- IPAny_Port: analogous to IP_Port
- ipport_equal: moved from DHT.c and adapted
DHTc.:
- ipport_equal renamed to ip4port_equal
|
|
- added ipany_ntoa()
network.c:
- added ipany_ntoa()
- fixed formatting
|
|
- IP4: changed in_addr_t to struct in_addr for compatibility reasons
- IP6: added
- IPAny: added
- addr_resolve_or_parse_ip(): converts a string into an IPAny
|
|
- IP: add in_addr_t as part of the union
- IP: rename IP to IP4
|