Commit Graph

1524 Commits

Author SHA1 Message Date
arvidn bc4d53c71f restore support for incoming connections over SOCKS5 (disabled by default) 2018-01-25 09:14:14 +01:00
arvidn 4fef787212 merged RC_1_1 into master 2018-01-24 00:37:05 +01:00
arvidn efd096d879 use unique peer_ids per connection 2018-01-23 16:40:16 +01:00
arvidn 785fffd976 make url_random take a span 2018-01-15 01:49:42 -05:00
arvidn a67eb2f059 fix tracker connection bind issue for IPv6 trackers 2018-01-14 06:47:13 -05:00
arvidn 65fef972a2 apply some c++11 modernization 2018-01-11 04:51:39 -05:00
arvidn 3a9861e237 complete the error handling test and make it part of the default simulation test suite. It will run a file transfer between two clients repeatedly, each time cause another memory allocation fail, until every single memory allocation has failed once. Any invariant check failure, assertion or signal will cause the test to fail 2018-01-08 04:44:52 -05:00
arvidn 88643dd121 fix m_in_constructor assert for peer_connection (if the peer connection is constructed, but bt_peer_connection constructor fails, it needs to be cleared). Fix an invariant in session on ungraceful shutdown. Make test framework a bit more robust 2018-01-06 14:29:20 -05:00
Alden Torres 98ade28237 using make_address instead of deprecated from_string when boost>=1.66 (#2659)
using make_address instead of deprecated from_string when boost>=1.66
2018-01-04 04:48:22 -05:00
arvidn 0731200149 block_size is a constant, no need in passing it around as a variable 2018-01-03 08:45:25 -05:00
arvidn aae12250ae support forced shutdown/destruction of torrent objects 2017-12-28 14:11:55 +01:00
arvidn 5f0c9a0c1d improve error handling during session shutdown 2017-12-28 13:52:07 +01:00
arvidn c1abafc0cc reserve space in the undead peers list up-front, to not have to allocate memory when disconnecting 2017-12-27 21:24:16 +01:00
arvidn 5ebd05b047 handle serious errors in on_accept_connection handler 2017-12-27 21:23:25 +01:00
arvidn ab9fcdf029 reserve space in torrent lists up-front, to make transitioning list membership unable to fail 2017-12-27 15:42:46 +01:00
arvidn 40292a1d51 don't heap-allocate handlers for incoming UDP packets 2017-12-24 11:22:30 +01:00
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
sledgehammer_999 94f4e88e05 Fix local network address mappings. 2017-12-20 11:28:36 +01:00
arvidn a54f76d5df deprecate status_code from tracker_error_alert (it's already part of the error_code), simplify code a bit 2017-12-19 00:55:51 +01:00
arvidn 96bf0ad5de fix reopening of listen sockets when disabling force-proxy 2017-12-17 08:25:51 +01:00
arvidn 55babc57e6 merged RC_1_1 into master 2017-12-15 17:18:27 +01:00
arvidn d1a63cd781 fix build against boost-1.66, specifically the boost.asio changes 2017-12-15 11:29:53 +01:00
Steven Siloti 9e0a3aead1 use info hash from params instead of passing it separately 2017-12-14 10:18:33 +01:00
arvidn 7b06a5ee6e merged RC_1_1 into master 2017-12-13 12:36:35 +01:00
arvidn fe6473039c fix rate limit utp feature 2017-12-11 08:40:35 -05:00
arvidn c16eb32b94 merge RC_1_1 into master 2017-12-03 18:12:35 +01:00
arvidn c745d3f00d fix incorrect use of make_tick_handler 2017-12-02 12:20:36 +01:00
arvidn 4b467f82ac fix issue with initializing settings on session construction 2017-12-02 12:20:36 +01:00
arvidn a6656aeb93 generate random keys for use in tracker announces. keys are unique for each torrent and the listen interface they announce via 2017-11-29 00:10:35 +01:00
arvidn 5e7666526e fix IPv6 tracker announce issue 2017-11-23 10:11:59 +01:00
arvidn a57ad00e15 fix force-proxy regression (udp sockets would not be opened) 2017-11-21 08:54:16 +01:00
arvidn 22f8bdfebc merge RC_1_1 into master 2017-11-21 00:50:02 +01:00
Arvid Norberg c734f42ac3
make tracker announces happen even if there are no open listen sockets (#2529)
support announcing to IPv6 trackers and running an IPv6 DHT when not listening for incoming connections
2017-11-20 23:42:22 +01:00
arvidn 096ce54fae fix issue where new listen sockets would not be opened when leaving force_proxy mode 2017-11-14 12:38:22 +01:00
arvidn d00451994b stop posting alerts when the session is shutting down. Nobody will be able to see them anyway. It also solves some issues around destruction order where posting alerts require certain things to still be around in the session_impl object 2017-11-12 09:12:59 +01:00
arvidn b88c193742 fix sign conversion warning in peer_class_type_filter 2017-11-11 09:17:37 +01:00
arvidn 1ed68551d7 merged RC_1_1 into master 2017-11-10 01:37:35 +01:00
arvidn f57b90b500 introduce type for torrent queue_position 2017-11-01 10:52:45 +01:00
Alden Torres 5480c08184 enable/disable the internal ip notifier with new setting (#2487) 2017-11-01 10:51:51 +01:00
Alden Torres f040d6d860 added reopen_network_sockets method to allow manual reopen of listen/outgoing sockets (#2476) 2017-10-28 12:15:35 +02:00
Steven Siloti dc612b6423 keep updating aux::time_now() while there are announces
This fixes an infinite loop when an announce during shutown fails and
aux::time_now() has fallen behind clock_type::now() by more than the
delay calculated in announce_entry::failed(). If this happens,
announce_entry::can_announce() can forever return true when called from
torrent::announce_with_tracker() because that function uses
clock_type::now().

Also change torrent::announce_with_tracker() to use aux::time_now() just
for consistency with the reset of the announce related functions.
2017-10-26 23:42:35 +02:00
arvidn 9e69bf3618 introduce a type to refer to a torrent-list-index, to improve type safety 2017-10-25 13:39:37 +02:00
Alden Torres 7216b69188 revert early return in session_impl::on_port_mapping and only check for error if cast_vote (#2468) 2017-10-24 09:54:57 +02:00
Alden Torres bb409c5ee9 missing return if error in session_impl::on_port_mapping, doc typo (#2459) 2017-10-23 12:36:51 +02:00
arvidn bb65acb082 make feature_flags proper type-safe 2017-10-14 23:33:48 +02:00
arvidn 9111d5977e make the variables holding the source of external IPs type-safe 2017-10-10 22:38:36 +02:00
arvidn 4e1c5738a2 back-port openssl API compat patch from master 2017-10-07 01:10:41 +02:00
Alden Torres 7f3c38025f making use of openssl API 1.1 compatible 2017-10-06 11:03:16 +02:00
arvidn 69dc73914a merged RC_1_1 into master 2017-10-04 11:43:01 +02:00
arvidn 99b19366a9 fix leak of peer_class objects (when setting per-torrent rate limits) 2017-10-03 17:32:49 +02:00
pavel.pimenov f3796060d3 add const 2017-09-29 14:06:40 -07:00
arvidn edad33d270 fix const correctness in get_peer_class 2017-09-24 14:49:55 -07:00
Steven Siloti 8648de3706 DHT nodes should only handle requests on their socket (#2355) 2017-09-21 21:00:38 -07:00
arvidn ccbd6cbcfe remove rss_reader.py, since rss has been reprecated. fix python binding for torrent_handle, to be hashable. update client_test.py to not use deprecated APIs and follow best (libtorrent) practice 2017-09-11 22:28:57 +02:00
Steven Siloti df8a57efb7 select which DHT port to report based on the connection's local endpoint (#2316) 2017-09-10 10:25:04 +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 fe1c395579 merged RC_1_1 into master 2017-09-03 13:57:19 +02:00
arvidn 7087a16b36 move some initialization of torrent from start() into the constructor 2017-09-02 21:24:00 +02:00
arvidn 11f008e90e use a strong typedef for port mapping id 2017-09-02 07:02:07 +02:00
Alden Torres ac914d4415 avoid port mapping of local addresses (#2296) 2017-09-01 19:28:27 +02:00
Arvid Norberg f734ad067b straighten out some type-safety in port mapping enums (#2285) 2017-08-30 20:47:49 +02:00
Alden Torres fe09ca9b97 more use of auto, const and minor cleanup in session_impl.cpp 2017-08-30 20:30:06 +02:00
Arvid Norberg 1075ae3b8d remove session pool allocator and use the buffer class instead (#2274)
simplify append_buffer by using size() to determine size of the buffer. make the move explicit in chained_buffer::init_buffer_entry
2017-08-28 11:37:53 +02:00
arvidn 1ce4089229 log failures to parse interface and node lists from settings 2017-08-24 07:59:22 +02:00
arvidn e92cbf502c remove the last use of session_impl get_ipv6_interface and get_ipv4_interface 2017-08-23 21:01:15 +02:00
arvidn f311bf354e remove left-overs from disk buffer pool allocator 2017-08-21 16:36:00 +02:00
Steven Siloti 2365611507 remove support for using a pool allocator for disk buffers (#2257) 2017-08-19 11:04:39 +02:00
Alden Torres bde4718e3f typos, auto loop refactor and more std:: 2017-08-16 07:01:50 +02:00
arvidn 6fa181ece8 some cleanup of type-safe flags 2017-07-30 18:20:15 -07:00
arvidn 322007bb6a make save_state_flags a strong type 2017-07-30 09:06:41 -07:00
arvidn 24e4263bae make torrent status flags be type safe 2017-07-27 09:33:35 -07:00
arvidn 8d0f38930e make udp send flags type safe 2017-07-26 18:09:17 -07:00
arvidn 83ca755d1b simplify setup_listener 2017-07-26 12:02:58 -07:00
arvidn b38efb6c65 make alert category flags be a strong type 2017-07-26 07:20:47 -07:00
Steven Siloti 5eba09fce7 changes based on review feedback 2017-07-21 19:18:44 -07:00
Steven Siloti 1a64490ef0 fix 2017-07-21 19:18:44 -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 e0dcd34352 convert m_listen_sockets to a vector of shared_ptr 2017-07-21 19:18:43 -07:00
Steven Siloti 0f30815d8f Revert "don't move listen_socket_t when deleting sockets"
This reverts commit 718c5f0dcb.
2017-07-21 19:18:43 -07:00
arvidn 4947602a2f make add_torrent_params::flags_t an enum class and move it out into its own header 2017-07-17 01:05:31 -07:00
arvidn c4afb5e949 use a dedicated class template for flags types instead of enum class. It's more backwards compatible and improves ergonomics 2017-07-15 01:15:57 -07:00
Steven Siloti 389b4eb3f2 make listen_socket_t non-copyable and non-movable (#2137)
The DHT stores a pointer to this struct so it must not be copied or moved once
it is stored in m_listen_sockets.
2017-07-10 10:14:36 -07:00
Steven Siloti 718c5f0dcb don't move listen_socket_t when deleting sockets
Pointers to listen_socket_t are stored in dht_tracker, so they
cannot be copied or moved once they are added to m_listen_sockets.

listen_socket_t should really be made non-copyable and non-moveable, but the
socket creation path needs to be refactored before that can be done.
2017-07-08 08:42:04 -07:00
arvidn 35491bc476 convert remaining alerts to use operation_t instead of string literal 2017-06-18 22:05:50 -04:00
arvidn ff454a92d4 unify some operation-enums and strings to use operation_t 2017-06-18 07:31:45 -04:00
arvidn 1fd350cf60 make operation_t an enum class, for type safety 2017-06-15 07:00:06 -04:00
Alden Torres 48ef3b6bf7 implemented support for BEP 51 (#1652) 2017-06-12 11:54:11 +02:00
Steven Siloti 67a530f3ab only listen on preferred IPv6 addresses on Windows
We shouldn't listen on addresses which are duplicates, deprecated,
or tenative unless explicitly requested.

This is only supported on Windows for now because the Linux interface
to get this information is much less convenient for libtorrent to use.
As far as I've been able to determine, Linux only exposes this information
via the RTM_NEWADDR and RTM_GETADDR netlink messages. Currently libtorrent
uses getifaddrs() to enumerate network interfaces on Linux so this will
probably need to be changed to use netlink if available.

MacOS: ???
2017-05-30 07:38:12 -04:00
arvidn afce0d3a86 make resolver_flags use enum class for improved type-safety 2017-05-29 18:38:59 -04:00
Steven Siloti 353ab20280 make session_handle hold a weak_ptr and be copyable (#2034) 2017-05-28 06:41:50 -04:00
Steven Siloti 893ef6479f don't abort the existing torrent when attempting to add it again 2017-05-17 00:57:52 -04:00
Steven Siloti 4bc9515766 close listen sockets after closing all connections (#1994)
This fixes an assertion failure on shutdown if an IPv6 UTP socket tries
to send a FIN to a closed UDP socket. Because the closed socket reports
its local_endpoint() as udp::endpoint() it trips the protocol check in
send_udp_packet.
2017-05-14 20:16:47 -04:00
arvidn e0fa1cd247 merged RC_1_1 into master 2017-05-12 21:46:45 -04:00
arvidn ff63557f58 bind upnp requests to correct local address 2017-05-12 18:17:38 -04:00
arvidn f8bda070be don't combine reuseaddr and exclusive addruse on windows 2017-05-11 22:30:29 -04:00
Arvid Norberg 1af17be046 use enum class for ssl bool in listen socket (#1960)
use enum class for ssl bool in listen socket. use std::array instead of C array. make test_listen_socket a bit more compact
2017-04-30 21:11:42 -04:00
Steven Siloti 540e1046e7 remove deprecated udp functions 2017-04-30 08:11:56 -04:00
Steven Siloti fd50630020 announce to trackers for all listen interfaces 2017-04-30 08:11:56 -04:00
Steven Siloti 761436dc97 add support for utp over multiple interfaces (#1944) 2017-04-25 23:00:41 -04:00
Steven Siloti cdd50be859 create a separate DHT node for each listen socket 2017-04-23 19:49:49 -04:00
arvidn b553cb32f7 fix storage destruction order issue 2017-04-22 17:30:31 -04:00
Steven Siloti 969c0167d4 remove calls to RAND_add
This function has been removed from LibreSSL and offers dubious value.
The PRNGs in modern operating systems are robust enough that these little extra
bits arn't going to make a difference.
2017-04-15 22:00:29 -04:00
arvidn 480bde9333 change formatting of namespace declarations 2017-04-12 14:26:35 -04:00
arvidn 79d7ae3638 separate path and filesystem functions out into its own translation unit/header file pair, separating it from the file and directory class 2017-04-11 18:07:55 -04:00
Arvid Norberg 09274842f7 fix resume data issue in client_test and some warnings (#1897)
fix resume data issue in client_test and some warnings
2017-04-09 09:37:06 -04:00
Arvid Norberg 13b16a63a3 use unsigned type for file flags. make file_pool private to disk_io_thread (#1894)
use unsigned type for file flags. make file_pool private to disk_io_thread. move close_file_interval logic to the disk thread. don't expose file in public interface, and make pool_file_status properly public (not part of file_pool and renamed to open_file_status), this is exposed in public interface via torrent_handle::file_status()
2017-04-08 18:24:50 -04:00
Alden Torres 65cf7af722 using unique_ptr for m_ip_notifier in session_impl 2017-04-05 17:43:12 -04:00
arvidn 9e5822dfba remove unused m_tick_residual accounting 2017-04-05 01:35:39 -04:00
Alden Torres 45bea967c2 added resolver_cache_timeout setting (#1878)
added resolver_cache_timeout setting
2017-04-04 18:23:37 -04:00
Alden Torres bb9b5bf4b8 schedule peer removal only if properly attached and handle special case of attach_peer (#1872)
schedule peer removal only if properly attached and handle special case of attach_peer
2017-04-01 12:15:20 -04:00
pavel.pimenov 6afb0fd51b fix m_host_resolver (for RC_1_1) 2017-03-31 07:29:03 -04:00
Alden Torres 990756ca38 code cleanup related to async_resolve (#1873) 2017-03-30 23:00:59 -04:00
arvidn d720b282b8 Merge branch 'master' of https://github.com/arvidn/libtorrent 2017-03-30 18:14:09 -04:00
arvidn 0b6fe4d0bd merged RC_1_1 into master 2017-03-30 18:07:24 -04:00
Pavel Pimenov 923f2c48fc fix m_host_resolver (#1871)
fix initialization order of m_host_resolver and m_tracker_manager
2017-03-30 08:47:41 -04:00
Arvid Norberg 8ebbad19d4 deprecate add_torrent_params::url field. use parse_magnet_uri instead (#1864)
deprecate add_torrent_params::url field. use parse_magnet_uri instead
2017-03-29 02:16:07 -04:00
arvidn 02bb1251d2 removed (broken) support for incoming connections over socks5 2017-03-29 02:15:43 -04:00
arvidn 86786770b7 merged RC_1_1 into master 2017-03-27 01:24:43 -04:00
arvidn 910ccc528f deprecate torrent_added_alert in favor of add_torrent_alert 2017-03-26 22:48:17 -04:00
arvidn 6cdd598e7c make add_torrent_params movable and have add_torrent/async_add_torrent take it by value 2017-03-26 16:48:57 -04:00
Arvid Norberg 103b1176c1 remove torrent_file_path asynchronous loading of .torrent files. (#1848)
remove torrent_file_path asynchronous loading of .torrent files. This is not the responsibility of the client, to simplify and unify the path of adding torrents
2017-03-26 09:16:42 -04:00
arvidn 7640c0641e optimize download queue management with an explicit queue 2017-03-25 20:47:33 -04:00
arvidn 8e6f417015 make torrent_status movable and don't allocate pieces unless it's asked for 2017-03-25 16:22:59 -04:00
arvidn 488c1a2dcf deprecated (undocumented) file:// urls, added torrent_file_path alternative 2017-03-23 20:26:55 -04:00
Alden Torres fcbcc250bb fix setup of DHT logic in session_impl::init (#1830)
fix setup of DHT logic in session_impl::init
2017-03-23 08:32:56 -04:00
arvidn df919d2a85 fix performance issue with async_add_torrent of file:// urls 2017-03-20 22:30:31 -04:00
Alden Torres 1280c7f7ae is_ip_address refactor and minor code cleanup (#1828)
is_ip_address refactor and minor code cleanup
2017-03-18 11:07:17 -04:00
Alden Torres 02ada49a3c added session log in start/stop dht 2017-03-17 23:57:20 -04:00
arvidn 3a1379ef1e merged RC_1_1 into master 2017-03-14 12:55:13 -04:00
arvidn 6f650aa7d9 document deprecation of dynamic loading/unloading of torrents 2017-03-13 21:21:38 -04:00
arvidn e37e4bfe8a include user-agent in tracker announces in anonymous_mode for private torrents 2017-03-12 21:10:00 -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
Alden Torres 6ab18136f0 created new session_stats_header_alert, master rebase 2017-03-10 21:04:12 -05:00
arvidn dec8c853e3 fix default file pool size on windows 2017-03-09 23:26:53 -05:00
arvidn 5cb12318c5 fix bug where settings_pack::file_pool_size setting was not being honored 2017-03-09 08:18:10 -05:00
arvidn 6d54c20adf merge RC_1_1 into master 2017-03-08 18:01:59 -05:00
Alden Torres 2a42058f74 minor refactor in counters_to_array and some typos 2017-03-08 08:27:00 -05:00
Arvid Norberg 7d3a8f5b19 don't remove peers from the connection list immediately when disconnecting (#1782)
don't remove peers from the connection list immediately when disconnecting them, but defer it until later. This makes it less error prone to disconnect peers in loops over the connections
2017-03-07 13:50:03 -05:00
Alden Torres eb39717b92 added log to on_ip_change and notify if ip_notifier is not supported (#1785)
added log to on_ip_change and notify if ip_notifier is not supported
2017-03-07 00:15:11 -05:00
arvidn faa2029f8b add feature to periodically close files (to make windows clear disk cache) 2017-03-06 23:46:47 -05:00
Alden Torres de9d777c9c fixing sign-conversion warnings, part 22 2017-02-26 15:37:45 -05:00
Alden Torres 847792854d fixing sign-conversion warnings, part 20 (#1745)
fixing sign-conversion warnings, part 20
2017-02-22 23:28:25 -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 267cab6822 fixing sign-conversion warnings, part 18 2017-02-21 01:41:34 -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 a670871519 fix build from RC_1_1 merge 2017-02-17 19:06:51 -05:00
arvidn 3ffa3f2a08 merged RC_1_1 into master 2017-02-17 00:35:49 -05:00
Arvid Norberg 116802fcdf update tuning documentation (#1717)
update tuning documentation and make the stats header be posted when logging is disabled (if stats_notifications are enabled)
2017-02-16 07:03:43 -05:00
Arvid Norberg ff22c68df8 packet pool fixups (#1682)
packet pool fixups
2017-02-10 20:54:26 -05:00