Commit Graph

128 Commits

Author SHA1 Message Date
Arvid Norberg 6aabe3762b general modernization (#836)
general modernization. use nullptr instead of NULL, use std::tuple instead of boost::tuple, transition some unordered set/map from boost to std. some clean-up of includes
2016-06-20 11:32:06 -04:00
Arvid Norberg ed077c8358 use cstdint intead of boost/cstdint.hpp (#833)
use cstdint intead of boost/cstdint.hpp
2016-06-18 14:01:38 -04:00
Arvid Norberg ead11737b4 fix uses of defines for whether or not asserts are active (#832) 2016-06-18 08:31:07 -04:00
Arvid Norberg ef1a24518d fix dht tests (#803)
fix tests
2016-06-11 15:37:28 -04:00
Alden Torres 9d3cf5e68b changed min_distance_exp for correctness and clarity (#789)
changed min_distance_exp for correctness and clarity
2016-06-06 18:22:33 -04:00
Arvid Norberg 223f24ca27 some cleanup and transition to std::unique_ptr (#786)
some cleanup and transition to std::unique_ptr
2016-06-05 14:07:24 -04:00
Alden Torres db65eb320a making dht counters additive (#783)
make dht counters additive to support both IPv4 and IPv6
2016-06-04 14:04:29 -04:00
Arvid Norberg 8c8f5bb03b deprecated public to_hex() and from_hex() functions (#784) 2016-06-04 10:01:43 -04:00
Alden Torres 7c4d92a627 Share the DHT storage for both IPv4 and IPv6 (#762) 2016-06-03 19:44:16 -04:00
Arvid Norberg 96999ad67f replace uses of boost::bind with std::bind and lambdas (#745) 2016-05-25 00:31:52 -04:00
Arvid Norberg 748af6eec1 general cleanup. remove valgrind markup, log_hash_failures and C headers (#752)
general cleanup. remove valgrind markup, log_hash_failures and C headers
2016-05-23 08:15:39 -04:00
Arvid Norberg 178a41b187 clean up natpmp logging infrastructure a bit as well as test_peer_list (#735)
clean up natpmp logging infrastructure a bit as well as test_peer_list
2016-05-18 01:54:37 -04:00
Arvid Norberg e8380e1d0b factor out includes from config.hpp into the files actually using it. primarily, printf family of functions, since C++11 version is used now. This removes the need for an snprintf-wrapper on windows (#732) 2016-05-17 09:24:06 -04:00
Arvid Norberg c6369194f0 simplify and optimize DHT routing table IP distance comparison (#696) 2016-05-03 23:22:25 -04:00
Arvid Norberg 077e9bb10c improve node-id operations (#693)
improve node-id operations, to operate on 32 bits at a time instead of 8. move out some code into sha1_hash.cpp, from the header file
2016-05-03 08:29:27 -04:00
Steven Siloti ff0675e64e use standard array container (#676) 2016-04-30 23:10:47 -04:00
Arvid Norberg 4e97bf556c use override and final keywords (unconditionally) (#668)
use override and final keywords instead of macros.
2016-04-30 11:05:54 -04:00
Arvid Norberg 3c785b96fc Merge pull request #268 from ssiloti/dht-ipv6
Support DHT over IPv6
2016-04-25 19:19:48 -04:00
Andrei Kurushin 62eb956c54 fix x64 build with VS2015 UP2 compiler (#640)
fix VS2015 compiler warnings for: address-model=64, deprecated-functions=on, link=shared
2016-04-25 17:22:09 -04:00
Steven Siloti 2d9a6b76f1 use asio::protcol instead of an enum/bool 2016-04-24 15:18:47 -07:00
Steven Siloti 2abd9867ce IPv6 DHT support
Fixes #110
2016-04-24 14:26:57 -07:00
Steven Siloti 356d2506bd extend dht_observer to support IPv6 external addresses 2016-04-24 14:26:57 -07:00
arvidn 06b52f1421 some cleanup of the dht_socket_interface and fix tests and simulations to build with the dht disabled 2016-01-18 14:34:42 -05:00
Steven Siloti ab7ef98b01 ensure all immutable items are stored at least once
If num_peers is set to 1 then the item will never be stored. Bump the
minimum value to 2 so that announce_immutable_items stores all items
at least once.
2016-01-12 19:32:02 -08:00
arvidn 651b473908 add unit test for routing_table::update_node_id 2016-01-11 23:47:27 -05:00
Alden Torres 0f442f59f3 Avoid pass IPv6 address to current implementation of DHT while adding a node 2016-01-09 18:46:19 -05:00
arvidn 07ddb010c5 split buckets when exceeding the next bucket's size, to make sure we split before risking discarding nodes because the next bucket is smaller 2016-01-02 00:45:44 -05:00
arvidn 01e6b93854 simplify and improve unit test for distance_exp. make some immutable variables const in the DHT implementation. instead of waking up periodically just to check if it's time to refresh the DHT secret key, set the timer to only wake up to refresh the key. If we don't have a DHT observer (to ask for our external IP) or if we don't know our external IP, don't generate a node ID based on 0.0.0.0, just generate a random ID instead. Simplified and improved node replacement logic in the routing table a little bit 2016-01-01 16:42:37 -05:00
Steven Siloti ac01ccc43a add templated wrapper around verify_message
It was too easy to forget to update the ret and size parameters
when the size of desec changed. With this change we now automatically
get the size of desc and enforce that ret has the same size.

It would be nice if we could use bdecode_node ret[static Size] from C99
but that is not widely supported.
2015-12-29 20:35:36 -08:00
arvidn 8732863a9a another fix to receiving malformed DHT error message 2015-12-03 01:08:27 -05:00
arvidn 550d75dab9 fix warning 2015-11-30 22:59:34 -05:00
arvidn eb8add0e57 fix missing include 2015-11-30 22:26:10 -05:00
arvidn 12dde0f415 actually add a test to the unit test 2015-11-30 19:07:35 -05:00
arvidn 7540a6e5cc correctly check incoming DHT error messages 2015-11-30 18:02:00 -05:00
Thomas Yuan c005c937fd Merge almost same functions. 2015-11-22 22:02:37 -05:00
Steven Siloti 1f13343a70 const correctness 2015-11-22 10:02:26 -08:00
Thomas Yuan ab70ad3e05 fix comments and unit test 2015-11-20 00:06:08 -05:00
Thomas Yuan 194ad410dc Make dht_put_alert more accurate. 2015-11-20 00:06:08 -05:00
Steven Siloti 08632aa5f7 add unit test to check for multiple calls to done() 2015-11-09 20:47:33 -08:00
Steven Siloti aa94f26b26 test_dht: use named parameter pattern for passing message arguments
The number of optional parameters for send_dht_request was already beyond
ridiculous and the addition of the 'want' argument pushed me over the top.
2015-09-27 19:16:24 -07:00
Thomas Yuan cfee70b350 unit test: a node with invalid node-id shouldn't be added to routing table. 2015-09-09 15:36:07 -04:00
Thomas Yuan 94a2c3131f Add unit test for DHT read_only nodes. 2015-09-08 11:03:27 -04:00
arvidn 0e3e3ea793 add simple unit test for creating hard links 2015-08-30 20:14:55 -04:00
arvidn be2b1d3991 split the dht test into a few parts (still need more splitting) 2015-08-23 09:23:51 +02:00
arvidn e7b8b6da49 forward port DHT routing table fix from RC_1_0 2015-08-22 15:51:28 +02:00
arvidn ffa870d280 fixed some GCC warnings 2015-08-20 01:33:20 +02:00
arvidn 24b20a59cd remove some randomness from the unit tests 2015-08-13 02:06:30 -04:00
Steven Siloti 86fd8c3048 enable arbitrary direct dht requests and extension dht requests
If you're wondering why I used an alert for handling responses but not requests,
it's because the former was easy to do that way but the latter would have
involved some major refactoring or kludging. The DHT node is written with the
(IMO reasonable) assumption that all responses will be generated immediately, so
there was no way to easily accommodate getting a response asynchronously via
an alert.
2015-08-10 20:33:04 -07:00
Steven Siloti 29ba738876 fix_dht mutable get test 2015-08-10 20:05:04 -07:00
Thomas e51b61870a Call callback function immediately when get mutable data. 2015-08-08 20:28:53 -04:00