Commit Graph

202 Commits

Author SHA1 Message Date
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
Jakob Petsovits 79947dbd2a Remove the last bits of TORRENT_DHT_VERBOSE_LOGGING. 2015-07-17 20:13:14 -04:00
arvidn 15dd15d0d6 fix no-deprecated build. extend .travis.yml to build the 3 test configurations too. rename README to README.rst 2015-06-05 02:31:52 -04:00
Arvid Norberg c8443d0c7c msvc fixes 2015-05-31 12:21:16 +00:00
Arvid Norberg f9c9d0ad0d merge small unit tests to make running the tests quicker. expand the test framework a bit. add ax_boost_random.m4 script to link against boost.random correctly from makefile. 2015-05-30 04:31:23 +00:00
Arvid Norberg e44c8e9002 optimize logging of DHT packets by deferring copying and printing, to only do it if the alert category is enabled 2015-05-28 20:36:22 +00:00
Arvid Norberg 99de70604a remove dht-verbose logging build configuration. tie it to the main logging configuration (which now is on by default) and make it less costly when dht logging alerts are disabled 2015-05-16 19:29:49 +00:00
Arvid Norberg ca577796d3 fix test build 2015-05-10 05:25:31 +00:00
Arvid Norberg ca581f2258 rename dht::node_impl -> dht::node, since this hasn't been a pimpl for quite a while 2015-05-09 19:00:22 +00:00
Arvid Norberg 6557910c7f remove the DHT's last dependency on session_impl 2015-05-09 18:06:02 +00:00
Arvid Norberg f5629eb403 cleanup and fixing of more warnings 2015-04-21 00:23:00 +00:00
Arvid Norberg 013ed36f09 landed alert_queue feature branch into trunk 2015-04-03 20:15:48 +00:00
Arvid Norberg 37225b71ae const static -> static const (thanks gubatron). helps swigs parser 2015-03-14 00:42:27 +00:00
Arvid Norberg 6c1df7eb55 landed the bdecode branch in master. lazy_bdecode/lazy_entry is now being replaced by bdecode/bdecode_node 2015-03-12 05:20:12 +00:00
Arvid Norberg 7668bf5d4c downgrade some todo comments 2015-01-15 19:13:45 +00:00
Arvid Norberg 0f37e3403c transition from intrusive_ptr to shared_ptr. don't export initialize_default_settings 2015-01-06 08:08:49 +00:00
Arvid Norberg 0977d94dbc merged changes from RC_1_0 2014-12-25 11:24:02 +00:00
Arvid Norberg 1e12b50b24 merge changes from RC_1_0 2014-11-30 00:30:30 +00:00
Arvid Norberg 8ec7cff993 merged changes from RC_1_0 2014-11-26 02:02:32 +00:00
Arvid Norberg aae56c991c merged changes from RC_1_0 2014-11-08 16:58:18 +00:00
Arvid Norberg 601f0dc434 merged changes from RC_1_0 2014-11-03 06:15:51 +00:00
Arvid Norberg 3742fd2699 merged changes from RC_1_0 2014-11-02 09:41:29 +00:00
Arvid Norberg a44900e5db merged changes from RC_1_0 2014-09-02 08:03:01 +00:00
Arvid Norberg 4d57456199 merged changes from RC_1_0 2014-09-02 06:28:27 +00:00
Arvid Norberg 48e4cf9478 merged changes from RC_1_0 2014-08-28 07:11:34 +00:00
Arvid Norberg 48ea42c990 merged changes from RC_1_0 2014-08-27 05:57:37 +00:00
Arvid Norberg 524384045c transition to use boost.random instead of rand() and custom pseudo random generator 2014-08-16 20:26:00 +00:00
Arvid Norberg 30d561d0c5 merged random_seed assert into trunk 2014-07-19 02:17:19 +00:00
Arvid Norberg 7351389ce8 land libtorrent_aio branch in trunk 2014-07-06 19:18:00 +00:00
Arvid Norberg 9f0aec9427 attempt at msvc-10.0 build fix for test_dhy + small documentation note 2014-04-01 00:09:23 +00:00
Arvid Norberg 043d540627 update dht unit test 2014-03-02 23:44:53 +00:00
Arvid Norberg c8b38dcacd fix dht unit test 2014-03-01 09:04:23 +00:00
Arvid Norberg 1188ec2dcd expose new DHT put/get functionality in the public session API 2014-02-24 00:31:13 +00:00
Arvid Norberg 6c22d426d4 make all unit tests pass msvc's /RTCc instrumentation (no implicit integer truncation in casts) 2014-02-05 09:38:32 +00:00
Arvid Norberg 86b68e65e4 merged dht node ID change from RC_0_16 2014-01-11 08:08:43 +00:00
Arvid Norberg ae7bb20170 update node ID generation algorithm from RC_0_16 2014-01-06 05:46:46 +00:00
Arvid Norberg 54bbd3cae0 support salt feature in DHT put 2014-01-03 04:18:46 +00:00
Arvid Norberg 260e97c4e0 document salt feature in put and get DHT extensions. include a test vector and add that to the unit test. (salt is not implemented) 2013-12-31 08:37:42 +00:00
Arvid Norberg d6b1aa4c36 DHT refactoring and support for storing arbitrary data with put 2013-12-27 04:28:25 +00:00
Arvid Norberg 1a2226b8f0 fix test_dht to take into account the slightly more relaxed semantics of routing_table::find_node 2013-10-22 05:20:00 +00:00
Arvid Norberg a627a4e156 add negative test for put/get DHT feature. fix bug in signature verification and in DHT unit test 2013-10-22 01:24:33 +00:00
Arvid Norberg 1b888eeec6 optimize DHT 2013-10-20 07:06:42 +00:00
Arvid Norberg 73323e2c3d more valgrind instrumentation 2013-10-16 08:11:19 +00:00
Arvid Norberg 0985c9e6c8 don't run the CPU intensive part of test_dht under valgrind 2013-10-14 08:52:45 +00:00
Arvid Norberg afd80cffb7 add option to enforce node ID in the DHT 2013-10-14 01:03:43 +00:00
Arvid Norberg 7bbb0e4e6c don't use random_seed in test_dht 2013-09-24 15:33:25 +00:00
Arvid Norberg e6f41c0d16 remove randomness from test_dht, to make it pass consistently 2013-09-24 08:14:50 +00:00
Arvid Norberg bb925ad671 fix build error in test_dht 2013-09-16 03:49:30 +00:00
Arvid Norberg 40941608a9 improve DHT routing table some, by replacing high RTT nodes within a node ID prefix 2013-09-14 21:49:08 +00:00
Arvid Norberg 39264c5ad3 introduce new, optional, get_peers mechanism that is more privacy preserving (doesn't leak the info-hash to as many DHT nodes) 2013-09-09 07:08:02 +00:00
Arvid Norberg 12fd5be372 fix bug in ed25519 DHT signature verification. removed RSA code as it's no longer used. add CAS feature (compare and swap) to DHT put command. update dht_store documentation 2013-09-03 00:45:48 +00:00
Arvid Norberg dd192cfd3c split up test_primitives into more tests (in an attempt to get the link-time down within the regression test time limit) 2013-09-01 01:10:50 +00:00
Arvid Norberg 4d7be9331b attempt at fixing test linkage on windows 2013-08-20 06:05:15 +00:00
Arvid Norberg 6bd07fd65f pull in an ed25519 implementation and replace use of RSA in the DHT with ECC. fix up makefiles 2013-08-18 16:01:20 +00:00
Arvid Norberg 410ef08e6a fix test builds 2013-06-26 19:16:21 +00:00
Arvid Norberg 465bbbf406 fix dht issue for platforms where char is unsigned. introduce assert 2013-06-23 08:07:39 +00:00
Arvid Norberg 78da577e2b big-endian fixes to test_primitives and more logging to track down error in test_dht 2013-06-23 01:22:44 +00:00
Arvid Norberg 002d69a9fc fix non-logging build of dht test 2013-01-19 07:01:03 +00:00
Arvid Norberg 51e99ba3e5 extend DHT unit test and fix bug in routing_table bucket splitting 2013-01-18 06:17:30 +00:00
Arvid Norberg cec9a16cc1 back-ported observer for set_external_ip for DHT 2012-04-30 06:30:35 +00:00
Arvid Norberg 918dce1341 back-ported part of the alert_dispatcher patch for the DHT 2012-04-30 05:39:35 +00:00
Arvid Norberg cda69425f9 typo in dht test 2012-03-19 00:56:38 +00:00
Arvid Norberg b1bb3fcc88 better support for dht test with no ipv6 support 2012-03-19 00:42:12 +00:00
Arvid Norberg 8213814102 DHT fix 2012-03-17 19:27:57 +00:00
Arvid Norberg 2bb53ce6e8 fix non-openssl builds and improved error messages for mutable puts 2011-05-25 02:41:48 +00:00
Arvid Norberg 6fa1827c39 add support for mutable put/get functions in DHT 2011-05-25 02:26:07 +00:00
Arvid Norberg 6830eb10a9 remove old search code from DHT. modify announce-item to fit with more recent proposal of get/put. Only immutable entries for now 2011-05-23 05:07:52 +00:00
Arvid Norberg 58d723012a support DHT scrape 2011-05-23 00:45:36 +00:00
Arvid Norberg 6f127dd07b fixed build with no deprecated functions 2011-05-01 19:28:13 +00:00
Arvid Norberg 0d300cd09a fixed test build and some clang warnings 2011-03-09 07:51:04 +00:00
Arvid Norberg de28a57954 add back version in DHT packets 2011-01-23 02:02:04 +00:00
Arvid Norberg 8ebc3e7f1e dht test cleanup 2011-01-22 18:44:48 +00:00
Arvid Norberg ba0aed2282 initial support for DHT RSS feeds 2011-01-19 05:57:44 +00:00
Arvid Norberg f21251cba8 limit number of torrents tracked by DHT and support DHT name lookups 2010-11-27 03:09:28 +00:00
Arvid Norberg fc1b44b560 improve error reporting of lazy_bdecode to use error_code 2010-10-28 04:01:59 +00:00
Arvid Norberg 51c544c6bb fixed trunk build with DHT disabled 2010-02-05 08:40:08 +00:00
Arvid Norberg 96cedc9b5f more beos fixes 2009-12-15 13:11:07 +00:00
Arvid Norberg 138fb8c679 extended DHT unit test to include error reporting 2009-09-27 17:41:51 +00:00
Arvid Norberg f36688a364 initial support for torrent tag store in DHT 2009-09-27 03:38:41 +00:00