Commit Graph
21 Commits
Author SHA1 Message Date
Adrien Béraud 95028e3770 dht: always use pseudo-RNG for non-critical random numbers 2020-02-07 00:36:42 -05:00
Adrien Béraud 616d6fe4b8 update copyright date 2020-01-03 15:14:32 -05:00
Adrien Béraud f418b3651f update copyright date 2019-03-16 12:37:23 -04:00
Adrien Béraud 4948bd7ad3 node cache: remove expired weak pointers from cache
Remove expired Node weak pointers regularly,
in a way that ensures that:
* every expired pointer gets eventually cleaned up
* expired pointer ratio remains reasonably low
* no cleanup pass blocks the node for too long,
* impact on performance is negligible

Impact on performance:
Every N insertions, at most N nodes are tested by iterating the map
-> performance impact in O(1) (constant).
2018-11-29 19:27:32 -05:00
Adrien Beraud dc99919338 InfoHash: add explicit operator bool() 2017-11-01 11:59:11 -04:00
Adrien Béraud 41ebbe21d4 node cache: expire nodes on destructions
Expiring nodes on cache destruction allow to cancel
any remaining request before the dht instance is destructed,
since Node instances might remain alive after the dht instance
is destroyed.
2017-10-30 13:12:16 -04:00
Adrien Béraud be2b9fd7dc NodeCache: handle end() lower_bound for non-empty map 2017-10-15 15:57:14 +02:00
Adrien Béraud 7df375fc75 NodeCache: fix invalid pointer access 2017-10-13 15:40:09 +02:00
Adrien Béraud e9f007025f node: make most fields private 2017-10-13 01:10:09 +02:00
Adrien Béraud e20ae56cab dht: support client mode
In client mode, a node won't store data
and won't participate in routing.
2017-10-12 15:44:14 +02:00
Adrien Beraud 73bcebf355 license cleanup 2017-04-10 01:43:20 +02:00
Simon Désaulniers b03a8b5b50 update license notice (2017) 2017-01-13 17:27:29 -05:00
Adrien Béraud 6d38c18572 introduce SockAddr to store IP addresses 2016-09-15 01:38:26 -04:00
Simon Désaulniers c04ede4909 dht: unify bootstrapSearch and refill method
Since bootstrapSearch was rewritten to use the node cache, it made it clear that
refill should be rewritten as such. However, then bootstrapSearch becomes
irrelevant.

An enhancement to refill is that it will let insertNode review its whole list
of nodes and then let it insert nodes up to SEARCH_NODES nodes. The previous
method would not garantee this behavior since, most of the times, it would pass
less than SEARCH_NODES nodes to insertNode.
2016-08-06 21:14:17 -04:00
Simon Désaulniers f6cd79952c node_cache: fix bad condition in getCachedNodes 2016-08-05 13:07:14 -04:00
kaldoran df3317a5b2 dht: bootstrap from cache instead of routing table 2016-08-03 10:04:02 -04:00
kaldoran 33f95c00a9 NodeCache: getNode takes bool not int
Since this was old code which use int as bool I edit that for a bool [and change related code]
2016-08-02 18:57:20 -04:00
Adrien Béraud bd72c6468f network engine: handle unexpected node id 2016-05-15 01:36:25 -04:00
Adrien Béraud d26a34f409 node_cache: use std::map 2016-05-13 16:38:23 -04:00
Adrien Béraud 040e3770ad node: use requests to determinate state 2016-05-09 16:17:59 -04:00
Adrien Béraud 8cc53b1751 add node cache, split dhtrunner.h from dht.h 2016-05-08 00:37:52 -04:00