Commit Graph

723 Commits

Author SHA1 Message Date
arvidn 753826cbb8 merger RC_1_1 into master 2017-12-23 18:15:01 +01:00
arvidn 62bf524e75 disable DHT logging with the TORRENT_DISABLE_LOGGING macros as well 2017-12-23 12:01:18 +01:00
arvidn 94dcd8e14b remove unused transaction id member of DHT observers 2017-11-12 15:46:33 +01:00
Alden Torres c771f16c5c lint guided refactor in dht source code (#2516) 2017-11-12 00:50:24 +01:00
arvidn f41d2b5d3b move shared_ptr instead of copying them, when constructing DHT observers 2017-11-08 23:09:43 +01:00
pavel.pimenov f3796060d3 add const 2017-09-29 14:06:40 -07:00
Steven Siloti 8648de3706 DHT nodes should only handle requests on their socket (#2355) 2017-09-21 21:00:38 -07:00
arvidn 93bb84d94c some random cleanup 2017-09-13 08:28:46 +02:00
Alden Torres 7cc2619aad more use of auto and minor code refactor in routing_table.cpp 2017-09-08 08:49:06 +02:00
arvidn bb51dcdbb9 move dht_settings into its own header cpp file-pair and dht_settings into the dht namespace 2017-09-04 22:38:16 +02:00
arvidn 7b98af8145 improve type-safety of observer_flags and traversal_flags 2017-08-05 20:20:13 +02:00
arvidn 6b1037eff5 convert enum values that are just used as constants, to actual constants with the correct type 2017-08-04 15:23:20 +02:00
arvidn 8d0f38930e make udp send flags type safe 2017-07-26 18:09:17 -07:00
Steven Siloti f0ae2145ea use a handle class for listen sockets instead of raw pointers
Listen socket handles need to be week_ptr so that they can detect when a listen
socket is removed in the middle of a tracker announce on it. Use a wrapper class
to enforce that no one outside of session_impl can hold ownership of the socket
across event boundaries.

To support unit tests, listen_socket_t is also split into a base class which
holds the members needed to support the public listen socket API.
2017-07-21 19:18:44 -07:00
Steven Siloti 2e79c5e648 fix handling of SSL listen sockets 2017-07-10 21:41:39 -07:00
Alden Torres 80036f0377 avoid executing timed async task if the dht node is already removed (#2133) 2017-07-08 08:32:24 -07:00
Steven Siloti ec2fb91aa5 reject put messages with incorrect bencoding (#2118)
add function to check for soft bdecode errors. reject put messages with incorrect bencoding
2017-07-02 18:30:32 -04:00
pavel.pimenov 7af38ba05a add const and static 2017-06-30 16:07:23 -04:00
pavel.pimenov 92a923134c fix generate_token 2017-06-30 13:22:30 -04:00
Alden Torres 48ef3b6bf7 implemented support for BEP 51 (#1652) 2017-06-12 11:54:11 +02:00
Pavel Pimenov 98a0344196 refactor traversal_algorithm look_for_nodes (#1982) 2017-05-29 12:20:52 -04:00
Steven Siloti 22145d8cfa don't assert when removing a link-local IPv6 interface 2017-05-20 06:10:06 -04:00
arvidn e870852c66 fix branch factor overflow in traversal algorithm 2017-05-13 08:10:21 -04:00
Alden Torres 4ea318faa0 compilation fix when not TORRENT_ASSERT 2017-04-26 13:46:35 -04:00
arvidn a9a12e873f make DHT bootstrapping more robust by not throwing away nodes 2017-04-25 23:03:52 -04:00
Steven Siloti bcfaf9621a fixes from review 2017-04-23 19:49:49 -04:00
Steven Siloti cdd50be859 create a separate DHT node for each listen socket 2017-04-23 19:49:49 -04:00
arvidn 480bde9333 change formatting of namespace declarations 2017-04-12 14:26:35 -04:00
arvidn 86786770b7 merged RC_1_1 into master 2017-03-27 01:24:43 -04:00
arvidn 4d397f5ebf fix minor robustness issue in DHT bootstrap logic 2017-03-21 12:29:08 -04:00
Alden Torres 014a07a5c8 allow DHT bootstrap to use nodes of both IP protocols 2017-03-17 20:51:38 -04:00
arvidn 3a1379ef1e merged RC_1_1 into master 2017-03-14 12:55:13 -04:00
Andrei Kurushin 713c412682 loop conversion #2 (#1804)
loop conversions. replace unsafe "erase(iter++)" with "iter = erase(iter)"
2017-03-12 11:34:42 -04:00
pavel.pimenov 78442e9a2c bdecode_node - add const 2017-02-27 19:44:12 -05:00
Alden Torres ee4d82d166 fix in DHT counters, alert types test, typos, formatting (#1747)
fix in DHT counters, alert types test, typos, formatting
2017-02-22 17:40:14 -05:00
Alden Torres 1e98bf19a5 added support for enumerating the internal DHT live nodes (#1712)
added support for enumerating the internal DHT live nodes
2017-02-18 23:02:23 -05:00
Alden Torres c8569b5e34 fixing sign-conversion warnings, part 12, minor refactor, eol cleanup (#1670)
fixing sign-conversion warnings, part 12, minor refactor, eol cleanup. created aux::clamp and default_piece_priority refactor
2017-02-07 00:22:30 -05:00
Alden Torres de6f2a9d88 fixing sign-conversion warnings, part 11, created aux::array and refactor (#1649)
fixing sign-conversion warnings, part 11, created aux::array and refactor
2017-02-04 22:05:53 -05:00
Arvid Norberg c00a25a645 back-port aldenml's fix to not save replacement nodes twice to 1.1 (#1661)
back-port aldenml's fix to not save replacement nodes twice to 1.1
2017-02-04 19:58:32 -05:00
Alden Torres 3ef4109bf3 avoid double saving of replacements nodes, removed replacement_cache, test (#1656)
avoid double saving of replacements nodes, deprecated replacement_cache, test
2017-02-04 11:25:11 -05:00
Arvid Norberg 29db3de6c0 wrap most instances of throw, and terminate on builds where exceptions are disabled (#1639)
wrap most instances of throw, and terminate on builds where exceptions are disabled
2017-01-29 15:37:42 -05:00
Alden Torres deecdb6cfa added support for infohashes sample in dht storage (#1586)
added support for infohashes sample in dht storage
2017-01-28 20:24:53 -05:00
Alden Torres 070e85090b more std:: prefix, consts, auto refactor, formatting 2017-01-26 08:30:20 -05:00
arvidn c15a575e34 remove dependency on aligned_storage and aligned_union to support older versions of GCC 2017-01-22 14:11:44 -05:00
Alden Torres c33af5a552 added dht_invalid_find_node counter metric 2017-01-18 00:55:32 -05:00
Alden Torres ef9d1ecd7f fixing sign-conversion warnings, part 6 2017-01-17 20:51:26 -05:00
Alden Torres a5825c0d2e fixing sign-conversion warnings, part 5, minor refactor (#1559)
fixing sign-conversion warnings, part 5, minor refactor
2017-01-16 21:51:49 -05:00
Arvid Norberg b52419d4d9 make the DHT log output deterministic (#1550)
make the DHT log output use the search ID rather than a pointer value. Make random_bytes() deterministic in simulations
2017-01-14 22:36:25 -05:00
Andrei Kurushin 78bacfe7c1 fix various build options 2017-01-07 10:49:42 -05:00
Pavel Pimenov 516e86d0ea Refactoring routing_table (#1468)
routing_table refactor. ip_set::count -> ip_set::exists. Fix copy-paste routing_table::remove_node
2016-12-28 14:40:56 -08:00
Arvid Norberg b74bdfa7db make dht logging deterministic (#1460)
make dht logging deterministic (ues an id instead of this-pointer to identify a traversal algorithm)

try with more DHT nodes
2016-12-27 07:12:57 -08:00
Pavel Pimenov c34a2541cc Log refactoring (#1446)
factor out common logging code in some dht traversal algorithms
2016-12-24 06:46:21 -08:00
Pavel Pimenov 6afb1f3e83 aux::to_hex(sha1) -> sha1.to_hex() (#1418)
generate hex strings into std::string instead of stack-allocated char arrays
2016-12-22 10:44:36 -05:00
Steven Siloti 916fc92c49 create separate function for reading a node from a list 2016-12-17 02:22:13 -05:00
Alden Torres 22b596945e enable /W4 warnings for msvc 2016-12-13 19:36:14 -05:00
Alden Torres f382936d56 headers, end of file, code cleanup 2016-12-12 23:36:45 -05:00
Steven Siloti ca07ee83a3 mark all converstion to bool operators as explicit 2016-12-12 01:34:36 -05:00
Alden Torres dd7179fb10 added a few consts to arguments and local variables 2016-12-10 18:19:14 -05:00
Alden Torres d5c4cd7280 fixed sign-compare warnings and some refactor (#1354)
fixed sign-compare warnings and some refactor. make sequence_number backed by std::int64_t
2016-11-27 08:46:53 -05:00
Alden Torres c30027e4a1 more integral type conversion warning fixes, now only needs shorten-64-to-32 (#1349)
more integral type conversion warning fixes, now only needs shorten-64-to-32
2016-11-25 11:17:25 -05:00
Alden Torres 86251adb1b more fixes of integral type conversion warnings 2016-11-21 20:22:18 -05:00
Alden Torres 84e0362180 more fixes in signed compare warnings (#1345)
more fixes in signed compare warnings
2016-11-21 01:49:56 -05:00
arvidn 0e33e62627 merged RC_1_1 into master 2016-11-20 11:18:16 -05:00
arvidn 4df1ecbe25 re-enable some warnings and fix code 2016-11-20 01:05:16 -05:00
Alden Torres 4c7e24ea35 more use of std::make_shared, fixing warnings of over-aligned 2016-11-18 00:28:29 -05:00
Andrei Kurushin 0a31e26344 fix logging=off build 2016-11-16 23:14:28 -05:00
Alden Torres 6751a1eeb1 removed spaces in template types and more c++11 auto/loop refactor 2016-10-26 00:08:00 -04:00
Arvid Norberg 6148984426 remove whitespace at end of line (#1245) 2016-10-22 11:47:24 -04:00
Arvid Norberg 25195a7260 back port DHT fixes from master (#1209)
back port DHT fixes from master
2016-10-14 23:47:59 -04:00
Angel Leon 9cdf0ee50c Boolean simplifications (oct 13th 2016) (#1211)
boolean simplifications
2016-10-14 16:13:18 -04:00
Arvid Norberg 540b5b28d7 use signed counters in traversa_algorithm, and add some more asserts (#1208)
use signed counters in traversal_algorithm, and add some more asserts
2016-10-14 08:03:09 -04:00
Arvid Norberg e0c8ad738d include target in DHT lookups, when queried from the session (#1207) 2016-10-12 23:39:00 -04:00
Arvid Norberg 6bb2d7c017 Sanitize 1.1 (#1197)
enable address sanitizer
2016-10-09 17:00:20 -04:00
Alden Torres 9343f2fbfb minor header cleanup and refactor (#1179) 2016-10-04 07:43:34 -07:00
Alden Torres 1974dca150 minor refactor of dht_default_storage (#1166)
refactor of dht_default_storage structures
2016-09-30 20:42:57 -04:00
Alden Torres 331a8d53c0 refactor to use move with dht_state (#1163)
refactor to use move with dht_state
2016-09-29 08:25:51 -04:00
Alden Torres af92e91a90 missing inc dht counter and minor cleanup (#1164) 2016-09-28 23:25:08 -04:00
Steven Siloti 85dd682551 fix adding a node with unknown id (#1161)
Commit a414e4c3 broke adding nodes with unknown id to the routing table by
causing them to be evicted when they responded with their real id. This should
have been caught by test_bootstrap, but a typo caused that test to silently
exit early.
2016-09-28 13:28:21 -04:00
Alden Torres 8caebbd026 alerts refactor to use span, don't break ABI when logging, fix compilation (#1159)
alerts to use span, don't break ABI when logging, fix compilation
2016-09-27 23:21:18 -04:00
Alden Torres 31ce1e5a2c dht headers and minor cleanup (#1157) 2016-09-26 18:04:42 -04:00
Alden Torres 4693fcf3f1 dht source code and headers cleanup (#1150) 2016-09-24 22:20:20 -04:00
Arvid Norberg 48a647a169 String view entry (#1147)
make entry support string_view in its interface, and make it efficient when in in C++14
2016-09-24 06:10:54 -07:00
Steven Siloti 2e0140b6f6 fix peer picking algorithm (#1141)
fix peer picking algorithm. The old code was always picking the first to_pick peers from the set.
2016-09-24 06:08:52 -07:00
Arvid Norberg 24b271b7c1 Merge pull request #1133 from ssiloti/peer-picker
fix DHT peer picking algorithm. The old code was always picking the first to_pick peers from the set.

* use a sorted vector to store peer announcments

Given the frequency of linear scans being done, std::set is clearly
sub-optimal for storing announced peers. A std::vector is the obvious
choice, which I also decided to make sorted. A sorted vector trades
better performance in announce_peer for slower purging, the latter
being mitigated by batching.

* shrink peers vectors with too much excess capacity
2016-09-23 13:48:00 -07:00
Steven Siloti 35cfc6b5d3 shrink peers vectors with too much excess capacity 2016-09-23 07:30:36 -07:00
Steven Siloti 89942bf3d4 use a sorted vector to store peer announcments
Given the frequency of linear scans being done, std::set is clearly
sub-optimal for storing announced peers. A std::vector is the obvious
choice, which I also decided to make sorted. A sorted vector trades
better performance in announce_peer for slower purging, the latter
being mitigated by batching.
2016-09-22 21:54:10 -07:00
Alden Torres c7ec987a1b refactor in msg verify_message and minor cleanup (#1131) 2016-09-21 23:04:05 -07:00
Steven Siloti 23e11af899 fix peer picking algorithm
The old code was always picking the first to_pick peers from the set.
2016-09-21 20:21:34 -07:00
Steven Siloti c75b243490 remove redundant protocol parameter (#1128) 2016-09-21 20:00:39 -07:00
Steven Siloti dad0000015 send write token if peer is alraedy stored 2016-09-20 19:35:24 -07:00
Steven Siloti e2fefb074a always drop the announcing peer when at capacity 2016-09-19 21:51:10 -07:00
Steven Siloti 6e24bbe77a only send a write token if we have storage space available 2016-09-19 21:51:10 -07:00
Alden Torres db14df5d0d dht code related refactor and cleanup (#1107)
dht code related refactor and cleanup
2016-09-18 20:08:15 -04:00
Arvid Norberg 80ba45e1fb clean up read_endpoint_list (#1102) 2016-09-18 10:12:54 -04:00
Alden Torres 6c31ea3d44 created dht state and session params refactor (#1100)
created dht state and session params refactor
2016-09-17 09:42:04 -04:00
Alden Torres d9489878a0 rpc_manager log optimization and minor refactor (#1095)
more on log optimization
2016-09-16 08:21:07 -04:00
Alden Torres 0507764d04 consts and refactor, hash_address returns the hash (#1093)
consts and refactor
2016-09-15 21:13:43 -04:00
Steven Siloti 3d3367387a check the address family of peers in get_peers (#1090) 2016-09-14 11:29:27 -04:00
Alden Torres c25bae163d avoid warnings with clang and minor dht_tracker code changes (#1092) 2016-09-14 11:28:50 -04:00
Alden Torres 65cdc15543 more on log, consts, refs and cleanup in dht related code (#1082)
more on log, consts, refs and cleanup in dht related code. moving print_state out of main source code
2016-09-13 08:18:47 -04:00