Commit Graph

414 Commits

Author SHA1 Message Date
Alden Torres 29a4075555 refactor to use std::shared_ptr with dht observer (#1057)
refactor to use std::shared_ptr with dht observer
2016-09-02 21:05:11 -04:00
Alden Torres fd4c09d7b2 refactor to use std::shared_ptr with traversal_algorithm (#1056)
refactor to use std::shared_ptr with traversal_algorithm. use a more stable linaro gcc link
2016-09-02 16:42:55 -04:00
Alden Torres 585a760588 headers cleanup (#1054)
headers cleanup
2016-09-01 15:04:58 -04:00
Steven Siloti 29e6cbbdae fix exit condition when parsing nodes (#1046)
fix exit condition when parsing nodes
2016-09-01 00:49:21 -04:00
Arvid Norberg 44a761e5c8 Merge pull request #1047 from ssiloti/rpcm-cleanup
rpc_manager: remove unused timer
2016-08-31 02:04:00 -04:00
Steven Siloti 134d62ab08 rpc_manager: remove unused timer 2016-08-30 19:40:11 -07:00
Alden Torres 658fa46f0a no warnings in random with openssl-1.1 and minor refactor 2016-08-30 21:23:08 -04:00
Alden Torres e2487c4d24 more use of std::shared_ptr refactor 2016-08-30 10:10:53 -04:00
Alden Torres 2ac45d17ef ed25519 api refactor (#1041) 2016-08-30 02:37:51 -04:00
Alden Torres 32f5f8f257 better integration and API for ed25519 (#1037)
better integration and API for ed25519. using shared_ptr in ed25519_add_scalar
2016-08-29 20:28:42 -04:00
Alden Torres c05e29c48e trivial cleanup and minor changes (#1033) 2016-08-26 00:14:11 -04:00
Steven Siloti 3a665a1040 fix inconsistant prefix calulcation (#1030)
The special case for calculating the prefix in the last bucket was being
applied to the condidate node but not the existing nodes in the bucket.
2016-08-25 19:26:48 -04:00
Alden Torres f51e782905 using string_view in node::incoming_request and plugin::on_dht_request (#1001)
use string_view in node::incoming_request. changed plugin::on_dht_request to use string_view
2016-08-15 16:17:13 -04:00
arvidn 8c8c3d5587 replace boost::function with std::function 2016-08-13 07:07:26 -04:00
Arvid Norberg e36e5efaba use boost::string_ref (#996)
use boost::string_ref/boost::string_view in various parts of the code, in file_storage, some file functions and in bdecode.
2016-08-13 07:04:53 -04:00
Alden Torres 74c8054e8d created session_params and refactor (#993)
created session_params and new session constructor
2016-08-11 20:32:14 -04:00
Steven Siloti a414e4c3fa remove nodes which change their id
This is based on a suggestion from the8472 to prevent malicious nodes from
polluting the routing table.

https://github.com/the8472/mldht/blob/sanitizing-docs/docs/sanitizing-algorithms.rst
2016-07-27 21:10:33 -07:00
arvidn 680a09cfa5 merged RC_1_1 into master 2016-07-26 02:14:58 -04:00
Steven Siloti 3321ca10f1 update our id in the rpc manager when it changes (#942)
update our id in the rpc manager when it changes
2016-07-24 21:30:36 -04:00
Arvid Norberg 9c2325ff6b modernize and improve type-safety of the DHT put implementation and test (#929)
modernize and improve type-safety of the DHT put implementation and tests. use unique_ptr instead of malloc for dht put items.
2016-07-23 15:57:04 -07:00
Alden Torres f57612b82d rename of aux::array_view to span (#933) 2016-07-22 09:31:42 -07:00
arvidn e405f0e02f merged RC_1_1 into master 2016-07-20 11:34:29 -07:00
Sivachandran 8f3bd1052e fix mutable dht_get_item failure when salt is non-empty (#909) 2016-07-18 07:12:10 -07:00
Arvid Norberg 1facf0eef6 clean-up more defines (#872)
clean-up more defines. remove TORRENT_DEBUG and TORRENT_DISABLE_INVARIANT_CHECKS (instead use TORRENT_USE_ASSERTS and TORRENT_USE_INVARIANT_CHECKS)
2016-07-01 19:46:59 -04:00
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
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 fa8232cd13 remove some old cruft and defines (#785)
remove some old cruft and defines
2016-06-04 10:03:13 -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 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 c6369194f0 simplify and optimize DHT routing table IP distance comparison (#696) 2016-05-03 23:22:25 -04:00
Arvid Norberg c91a700c07 Msvc warnings (#685)
fix msvc warnings and build examples with warnings-as-errors
2016-05-02 12:36:21 -04:00
Steven Siloti ff0675e64e use standard array container (#676) 2016-04-30 23:10:47 -04:00
Arvid Norberg 20b41ad0b9 Threads (#671)
use std::thread, std::mutex, std::condition_variable instead of pulling them in from boost.asio internals.
2016-04-30 18:54:23 -04:00
Arvid Norberg 98fb7df56f use standard unordered containers (#673) 2016-04-30 16:53:20 -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
Steven Siloti 11fa4f3e47 support IPv6 in node_entry and m_ips 2016-04-24 14:26:57 -07:00
Arvid Norberg 7251575d98 This patch does: (#633)
1. simplifies and regularizies creation of listen sockets based on the listen
   interfaces setting.
2. simplifies and improves the behavior of UDP sockets, which are now explicitly
   opened per listen interface
3. transitions udp tracker, DHT and uTP socket manager over to using the new
   udp sockets
4. greatly simplified udp_socket to only wrap a single underlying socket (as
   opposed to one IPv4 and IPv6 socket)
5. improved behavior of bind-to-device
6. introduce an array_view type to make udp packet passing code simpler
7. simplify and make setting of DF flag more robust
8. simplify and regularize port mapping of listen sockets
2016-04-24 15:26:28 -04:00
arvidn d17ae19391 Merge branch 'RC_1_1' 2016-04-11 02:08:06 -04:00
arvidn 08edf43b3f fix to documentation generation to exclude private functions. fix makefile errors 2016-04-09 00:33:26 -04:00
arvidn 6d85c7c5f0 merge RC_1_1 into master 2016-03-08 01:10:48 -05:00
Alden Torres 4998bfedc6 Documentation typos 2016-03-04 10:43:25 -05:00
arvidn 3842a0a197 Merge branch 'RC_1_1' 2016-02-12 15:43:13 -05:00
Alden Torres feb2fd34d6 Documentation typos and new lines 2016-02-11 19:53:43 -05:00
arvidn d5203c67d9 add DHT rate limit test (simulation). introduce a new counter for dropped incoming dht messages. 2016-01-18 14:34:42 -05: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
arvidn 297b8943d0 move the DHT rate limiter into the dht_tracker class and remove the rate_limited_udp_socket type. This further simplifies the udp socket (preparing for moving it into the listen_socket structure) 2016-01-18 14:34:41 -05:00
arvidn 1f9f588e75 merge copyright year update and changelog from RC_1_0 2016-01-17 18:57:46 -05:00
arvidn 651b473908 add unit test for routing_table::update_node_id 2016-01-11 23:47:27 -05:00
arvidn f4d643bd2d instead of restarting the whole DHT when changing external IP, just rebuild the routing table and change the node IDs 2016-01-11 21:17:25 -05:00
arvidn e3ba811ae4 improve name of m_timer in dht_tracker 2016-01-01 16:42: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
Arvid Norberg ffb78f0378 Merge pull request #312 from ssiloti/export-verify-message
export verify_message and incoming_error
2015-12-30 22:51:38 -05:00
Steven Siloti 30076218f8 entry is a class not a struct 2015-12-30 17:25:00 -08: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 505ae508f4 mark up some override functions and fix other clang warnings 2015-12-13 19:44:42 -05:00
Steven Siloti c6f1e0bd7b export verify_message and incoming_error
Also move these functions to a new msg.cpp. They are useful for plugins
which implement DHT extensions.
2015-12-05 18:20:08 -08:00
arvidn 98c9ac0448 fix msvc build 2015-12-03 19:28:57 -05:00
arvidn 69f4e94995 null_observer is used in a test now 2015-12-03 07:51:53 -05:00
arvidn 12dde0f415 actually add a test to the unit test 2015-11-30 19:07:35 -05:00
arvidn 332799bff2 make alert types declared final and disable the log alert declarations when logging is disabled 2015-11-29 10:16:02 -05:00
Steven Siloti 9c7edf803e add override and a TODO 2015-11-22 18:58:32 -08:00
Steven Siloti 9f7aa7f3a6 fix segfault in put_data
If less than three nodes are found to put an item to then traversal_algorithm::start
will add router nodes. This leads to a crash in put_data::invoke when it tries to
read a token from uninitialized memory in a null_observer.
2015-11-22 16:05:24 -08:00
Steven Siloti 1f13343a70 const correctness 2015-11-22 10:02:26 -08:00
Arvid Norberg 42b129b9d5 Merge pull request #178 from thomas-yuan/put
Make dht_put_alert more accurate.
2015-11-21 02:30:45 -05: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
arvidn fba0762353 fix some msvc warnings 2015-11-19 19:01:54 -05:00
Steven Siloti c2277b3ea5 fix traversal_algorithm::done() being invoked more than once
A traversal can be done while there are still outstanding queries (i.e.
m_invoke_count is non-zero) if K good responses have already been received and
none of the outstanding queries are closer than the nodes which have responded.

When this happens and the outstanding queries eventually complete or timeout
they call traversal_algorithm::failed() or traversal_algorithm::finished() as
usual which will cause traversal_algorithm::done() to be called yet again.

The fix is to always set the done flag on all queried observers in
traversal_algorithm::done() so that the observers will refrain from calling
back into the traversal.

This also makes traversal_algorithm::abort() redundant since this was the only
thing it did before it called into done().
2015-11-09 20:47:33 -08:00
arvidn 3cc464805f update libsimulator submodule 2015-10-25 10:55:20 -04:00
arvidn 74ee06bff7 add more override annotation 2015-10-17 02:20:38 -04:00
Alden Torres cf4c8d0058 Minor refactor in direct_traversal and some typos in bdecode header. 2015-10-08 09:15:16 -04:00
arvidn 41b8429cd1 clean up documentation makefile and documentation generation script 2015-10-07 00:48:43 -04:00
Alden Torres 62b24d8b67 Add set_dht_storage to session API. 2015-10-02 09:00:07 -04:00
Thomas Yuan f9fa8ffdec Use ping instead of get_peers if current bucket is full. 2015-09-22 10:35:10 -04:00
Alden Torres 25ed70b977 Create dht_storage_counters to avoid internal counter in future public API. 2015-09-21 07:46:23 -04:00
Alden Torres e2d682275a Implementing and using new dht storage interface 2015-09-16 08:30:27 -04:00
Thomas Yuan bee620b4f1 Fix routing_table bucket_size(int bucket) out_of_range logic error. 2015-09-10 17:19:00 -04:00
Thomas Yuan d6bb387ab9 Use dht_settings directly instead of add a read_only member variable.
Since rpc_manager has a reference of dht_settings, needn't pass it
as a parameter for incoming().
2015-09-08 10:35:30 -04:00
Thomas Yuan 3d4ed9f37f Add read-only support in dht_settings and outgoing query messages. 2015-09-07 14:24:46 -04:00
arvidn 17c5759829 disable warning for unused command line argument and fix warnings. remove redundant travis build config. use new preprocessor on clang to avoid warnings 2015-09-06 22:55:41 -04:00
Thomas Yuan ef16ae4e27 Handle response with unexpected format. 2015-08-31 22:37:46 -04:00
Thomas Yuan b26d08c66a Remove unnecessary selection statements. 2015-08-26 11:26:21 -04:00
arvidn ffa870d280 fixed some GCC warnings 2015-08-20 01:33:20 +02:00
arvidn a3608a39fe fix some warnings 2015-08-19 02:00:46 +02:00
arvidn 347d976a70 since starting the DHT can be delayed now, also cache dht nodes added while waiting 2015-08-18 23:35:27 +02:00
arvidn 8d8c049d9e fix warnings and invalid defines in disk_io_thread.cpp 2015-08-18 07:55:50 -04:00
Alden Torres b303a36ac2 Removed unnecessary full namespace reference to udp::endpoint in new dht_direct_request feature.
Add default value to userdata argument in dht_direct_request.
Minor spelling fix.
2015-08-12 00:49:09 -04:00
Steven Siloti 182c30f2d6 fix typo in class name 2015-08-10 20:33:04 -07: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
Arvid Norberg 27c5a28637 Merge pull request #70 from thomas-yuan/master
Call callback function immediately when get data for mutable data.
2015-08-08 21:51:18 -04:00
Thomas e51b61870a Call callback function immediately when get mutable data. 2015-08-08 20:28:53 -04:00
arvidn a91e7ce25d fix warnings 2015-08-06 02:30:06 -04:00
arvidn 655a3ae019 fix some warnings 2015-08-01 23:57:11 -04:00
Alden Torres fcac7140f8 Added dht_get_peers and dht_announce at session_impl level. 2015-07-01 15:30:08 -04:00
Alden Torres 5c8c9cd653 Refactor to expose a more convenient get_peers function as part of the DHT api.
Now announce (a particular case of get_peers DHT operation) uses the function get_peers.
2015-06-24 21:22:24 -04:00
arvidn 9af8841244 remove some unnecessary asio typedefs in the libtorrent namespace, just pull ip::tcp and ip::udp 2015-06-06 13:49:18 -04:00
arvidn 41533205be drop support for boost 1.35 and fix some more references to the asio namespace 2015-06-06 02:10:53 -04:00
Arvid Norberg d43f7b56a2 update copyright year 2015-06-03 05:18:48 +00:00
Arvid Norberg 84849f3afd some msvc fixes 2015-05-30 21:46:59 +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 06bf225237 fix release build and tune want_tick 2015-05-26 20:09:19 +00:00
Arvid Norberg 9856a1fe0c break out more tests from test_primitives 2015-05-23 01:38:47 +00:00
Arvid Norberg 0052fa6c19 some cleanup to dht observers (don't expose internals) 2015-05-22 02:42:26 +00:00
Arvid Norberg b480f40a98 fix linux build and update code coverage script 2015-05-17 21:00:47 +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 242dad0743 fix dht build 2015-05-10 18:24:09 +00:00
Arvid Norberg 2819d5f68e remove the remains of the dht logging 2015-05-10 05:28:50 +00:00
Arvid Norberg 1357fd5265 clean up usage of printf attribute (encapsulate it in a macro) 2015-05-10 05:11:51 +00:00
Arvid Norberg b60934288b turn DHT logging into alerts instead of writing to a file 2015-05-10 04:54:02 +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 2fff222235 silence some warnings on msvc 2015-04-27 02:21:12 +00:00
Arvid Norberg 93a19b44c0 fix another format string issue and add comments to kademlia 2015-04-26 06:25:08 +00:00
Arvid Norberg 3951377d95 fix include paths for warning push and pop headers 2015-04-21 01:16:28 +00:00
Arvid Norberg f5629eb403 cleanup and fixing of more warnings 2015-04-21 00:23:00 +00:00
Arvid Norberg 4d15f1410f fix warnings, some clean-up and todo comments 2015-04-20 04:52:49 +00:00
Arvid Norberg 21751347bc more warnings fixes and cleanup 2015-04-19 06:28:21 +00:00
Arvid Norberg 51e86ca2d5 more warning fixes and cleanup 2015-04-18 22:00:27 +00:00
Arvid Norberg 408232cfc8 raise warning level. fix a few of them. filter out warnings from boost 2015-04-18 02:33:39 +00:00
Arvid Norberg 013ed36f09 landed alert_queue feature branch into trunk 2015-04-03 20:15:48 +00:00
Arvid Norberg 32ccf61603 fix test_dht build 2015-03-17 01:30:57 +00:00
Arvid Norberg 1b07ec491d fix build issue out of recent changes of exported functions 2015-03-16 04:38:28 +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 c1dc982f4f deprecate the ptime type and related time types. just use boost::chrono / std::chrono 2015-03-12 04:34:54 +00:00
Arvid Norberg 0afea4bb3e move some DHT verbose stats logging over to performance counters 2015-01-18 01:06:36 +00:00
Arvid Norberg 22a02f4a1f make dht_tracker be held by shared_ptr instead of intrusive_ptr. remove redundant performance counter (total dht sent/received). report DHT IP overhead to the IP overhead counters 2015-01-17 22:06:30 +00:00
Arvid Norberg 58d93e5aa1 add new (non-deprecated) access to dht stats, asynchronously via an alert 2015-01-17 17:02:58 +00:00
Arvid Norberg 35b41858cf deprecated session_status and session::status() in favor of performance counters 2015-01-04 21:31:02 +00:00
Arvid Norberg dbf461ac23 make DHT dos mitigation parameters configurable via dht_settings 2015-01-01 23:24:21 +00:00
Arvid Norberg 1ed1963f29 remove size_type typedef in favor of boost::int64_t 2014-12-03 04:32:50 +00:00
Arvid Norberg 658e2ceefd merged Steven Siloti's peer crypto patch into trunk 2014-11-23 06:14:47 +00:00
Arvid Norberg 179df62379 merged changes from RC_1_0 2014-11-20 05:53:12 +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 34af25beaa merged chagnes from RC_1_0 2014-11-01 22:47:56 +00:00
Arvid Norberg a91848962a merge changes from RC_1_0 2014-10-12 04:18:34 +00:00
Arvid Norberg 8cbef3876a post alert on outgoing get_peers 2014-09-22 19:49:32 +00:00
Arvid Norberg 48ea42c990 merged changes from RC_1_0 2014-08-27 05:57:37 +00:00
Arvid Norberg 3f88389f05 merged changes from RC_1_0 2014-08-16 07:46:06 +00:00