summaryrefslogtreecommitdiff
path: root/toxcore/DHT.c
AgeCommit message (Collapse)Author
2013-12-13Merge pull request #678 from FullName/retipp-fixirungentoo
Fix a code cleanup.
2013-12-12Merge branch 'assoc-refresh-distant-data' of ↵irungentoo
https://github.com/FullName/ProjectTox-Core into FullName-assoc-refresh-distant-data
2013-12-11Fix a code cleanup.Coren[m]
DHT.c: - get_close_nodes(): - allow two 'indirect' nodes ('indirect' as in distant from us and therefore not tested regularly, "bad") - be consequent when testing for NULLed results, pack nodes_list dense - (logging) dump number of found entries from assoc - returnedip_ports(): - fix code cleanup, the entry to be added is about the node we were told, not about the node who told us assoc.c: - Assoc_get_close_entries(): break from loops as soon as a marking-invalid-node is hit
2013-12-11Increased some intervals/timeouts to lower network usage.irungentoo
2013-12-08Cleaned up and fixed various things.irungentoo
2013-12-08Send groupchat ips like DHT ones.irungentoo
2013-12-08Compatibility fixes.irungentoo
AF_INET/AF_INET6 can vary across devices, we introduce TOX_AF_INET and TOX_AF_INET6 to fix this.
2013-12-08do_Assoc(): keep the data of the buckets somewhat currentCoren[m]
2013-12-07Small fixes.irungentoo
2013-12-07Added/updated some basic docs and cleaned up some things.irungentoo
2013-12-07Try to replace not tested/possibly bad nodes before good nodes.irungentoo
2013-12-06Merge branch 'master' into hardenirungentoo
2013-12-05All nodes returned must be good.irungentoo
2013-12-05Merge branch 'sendnodes-with-assoc' of ↵irungentoo
https://github.com/FullName/ProjectTox-Core into FullName-sendnodes-with-assoc
2013-12-03get_close_nodes(): make use of assoc to find some really close nodesCoren[m]
DHT.c: - get_close_nodes(): use assoc to find nodes for the requested reference id - handle_sendnodes*(): set a proper timestamp for "heard" nodes assoc.*: - expand Assoc_close_entries by flags for additional restrictions for search - Assoc_get_close_entries(): honor the new flags - new_Assoc() prime handling: min. prime is now 5 instead of 3, and up to 25 is handled directly - Assoc_status(): added address family for seen/heard, print of hash is now fixed width
2013-12-02Don't hole punch when we are connected.irungentoo
2013-12-02Fixed bug with hole punching.irungentoo
2013-12-01Tweaked hole punching a bit.irungentoo
2013-11-30The stuff in do_DHT only need to be run once per second.irungentoo
Should lower CPU usage by a bit.
2013-11-18Merge pull request #650 from FullName/ID-IP-basicirungentoo
Significantly trimmed down version of an ID<=>IP cache.
2013-11-17Nodes now only send good nodes (or the node that was specifically asked for).irungentoo
2013-11-17Tolerate instable connectivity: if *all* set close nodes are in terminal ↵Coren[m]
timeout (KILL_NODE_TIMEOUT), reset them all to BAD_NODE_TIMEOUT. That keeps the client trying to at least ping the nodes in the hopes of the connection coming back up.
2013-11-17Assoc's array is now allocated dynamically and per default much smaller (320 ↵Coren[m]
entries). id_hash() was not at all working as expected for very small bucket size (when (size / 4) was zero). Simplified to be trivially correct. Also added a used flag on adding an entry, which is set by callers if they have that association in active use. Those get priority over unused entries on collision. Fleshed out test to be at least elementary useful. Each group chat now uses an own, small assoc (80 entries).
2013-11-14Significantly trimmed down version of an ID<=>IP cache.Coren[m]
Besides acknowledging timeouts, the module isn't trying to do anything fancy with the data besides storing and retrieving.
2013-11-14On replacing a client with another, clear the stale association.Coren[m]
Also check both associations for timeout, not just the incoming one. Also removed client_in_list(): static & unused.
2013-11-10Fixed small issues.irungentoo
DHT_test now only prints non zero entries.
2013-11-10Added more printing to DHT_test, fixed typo.irungentoo
2013-11-10Merge branch 'master' into hardenirungentoo
Conflicts: toxcore/DHT.c
2013-11-07Merge branch 'add2lists_forward' of ↵irungentoo
https://github.com/FullName/ProjectTox-Core into FullName-add2lists_forward
2013-11-06Unify most of handle_sendnodes[_ipv6]() into a common ↵Coren[m]
handle_sendnodes_core(), leave only a minimal trail.
2013-11-06addto_lists(): store the IP/Port that was used to *send*.Coren[m]
Avoids a DOS of sending a copy of a valid response with an invalid IP.
2013-11-02Get node testing response packets are now handled.irungentoo
2013-10-30Testing requests are now sent.irungentoo
2013-10-28Merge branch 'master' into hardenirungentoo
Also removed some old, useless loading code.
2013-10-28Removed some now useless code.irungentoo
2013-10-27Added some hardening functions to test get nodes.irungentoo
2013-10-26Base of hardening stuff.irungentoo
2013-10-24Removed now useless ping_id from send/get node packets.irungentoo
2013-10-24Adding encrypted data to send/getnode packets now done.irungentoo
2013-10-24Move unix_time(), id_cpy()/id_eq(), is_timeout() to util.*Coren[m]
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()
2013-10-24Adding encrypted data to send/getnode packets part 1.irungentoo
2013-10-24Removed define that could become confusing.irungentoo
2013-10-20Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then ↵Coren[m]
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-12Improved hole punching.irungentoo
2013-09-30Speeded up/fixed NAT hole punching and peer finding.irungentoo
2013-09-28Fixed small issue.irungentoo
2013-09-28Behaviour with LAN ips is now better, also fixed possible bug.irungentoo
2013-09-28LAN ips can be sent to LAN ips.irungentoo
2013-09-28friend_iplist and route_tofriend behaviour fixes.irungentoo
2013-09-27Fixed possible problem.irungentoo