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