Commit Graph

628 Commits

Author SHA1 Message Date
arvidn 40292a1d51 don't heap-allocate handlers for incoming UDP packets 2017-12-24 11:22:30 +01:00
arvidn 62bf524e75 disable DHT logging with the TORRENT_DISABLE_LOGGING macros as well 2017-12-23 12:01:18 +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 c16eb32b94 merge RC_1_1 into master 2017-12-03 18:12:35 +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
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 0378ae47f4 fix some macro expansions of 'max' in headers, to improve compatibility with windows.h 2017-11-12 23:01:47 +01:00
arvidn b6a73eeaaa simplify trigger_unchoke and trigger_optimistic_unchoke on session_impl, abd make them noexcept 2017-11-12 15:48:46 +01:00
arvidn fc74c032f0 minor cleanup and modernization of torrent_peer 2017-11-09 15:48:27 +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
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 bb409c5ee9 missing return if error in session_impl::on_port_mapping, doc typo (#2459) 2017-10-23 12:36:51 +02:00
arvidn 9111d5977e make the variables holding the source of external IPs type-safe 2017-10-10 22:38:36 +02:00
arvidn 1d15e6bfb4 merge RC_1_1 into master 2017-10-08 18:21:25 +02:00
arvidn cdd9f91999 fix leak of torrent_peer objecs (entries in peer_list) 2017-10-07 11:43:42 +02: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 93bb84d94c some random cleanup 2017-09-13 08:28:46 +02:00
arvidn 735f6fd1f4 remove redundant virtual specificers when override is present 2017-09-10 19:28:18 +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 11f008e90e use a strong typedef for port mapping id 2017-09-02 07:02:07 +02:00
Arvid Norberg f734ad067b straighten out some type-safety in port mapping enums (#2285) 2017-08-30 20:47:49 +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 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
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 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
Steven Siloti 5eba09fce7 changes based on review feedback 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
Steven Siloti 2e79c5e648 fix handling of SSL listen sockets 2017-07-10 21:41:39 -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
Alden Torres 48ef3b6bf7 implemented support for BEP 51 (#1652) 2017-06-12 11:54:11 +02:00
Steven Siloti 353ab20280 make session_handle hold a weak_ptr and be copyable (#2034) 2017-05-28 06:41:50 -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 91838d8a65 clean up declaration for removed function 2017-04-12 21:00:41 -07:00
arvidn 480bde9333 change formatting of namespace declarations 2017-04-12 14:26:35 -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 cec874591d moved ip_notifier.hpp to aux_ 2017-04-05 20:37:32 -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
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
arvidn 02bb1251d2 removed (broken) support for incoming connections over socks5 2017-03-29 02:15:43 -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
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 64f5567cdd merged RC_1_1 into master 2017-03-19 12:58:55 -04:00
arvidn 17bc05c582 improve stats counter documentation 2017-03-18 08:22:24 -04:00
arvidn 6d54c20adf merge RC_1_1 into master 2017-03-08 18:01:59 -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
arvidn faa2029f8b add feature to periodically close files (to make windows clear disk cache) 2017-03-06 23:46:47 -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 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
Alden Torres 4d5ddc90f5 fixing sign-conversion warnings, part 14, minor refactor 2017-02-10 15:27:49 -05:00
Arvid Norberg 9e4045ed42 use 32 bit time points in torrent (#1662)
use 32 bit time points in torrent and add some slack to time point comparisons in python test
2017-02-05 19:18:06 -05:00
Alden Torres 8b98bf2c9d more use of peer_class_t in public API 2017-01-22 14:06:27 -05:00
arvidn 61c057947c add typedefs for shared_ptr and make_shared, to make transition to 1.2 easier 2017-01-21 23:10:33 -05:00
Arvid Norberg 6a701437b6 use strong_typedef for peer_class_t type (#1595)
use strong_typedef for peer_class_t type
2017-01-21 22:40:19 -05:00
Alden Torres 1874a917b0 added std:: prefix, end of file cleanup, formatting, consts 2017-01-14 05:59:26 -05:00
Alden Torres a31ba7972d fixing sign-conversion warnings, part 3 (#1537)
fixing sign-conversion warnings, part 3. making aux::vector index type default to int
2017-01-13 01:55:29 -05:00
arvidn 4ebc344e48 make disk_io_thread responsible for the storage object. torrents refer to it by index 2017-01-01 13:54:39 -05:00
Pavel Pimenov 98cdc3192d Missing member init (#1467)
initialize members of piece_block and use default member initialization.
2016-12-29 06:55:58 -08:00
Arvid Norberg af126fe507 make buffer_allocator_interface an implementation detail of the disk_io_thread (#1463)
make buffer_allocator_interface an implementation detail of the disk_io_thread by using disk_buffer_holder in the disk interface. make chained_buffer use holders instead of free deleter functions and userdata to support putting disk_buffer_holder objects in there. Also make the session buffers be held by holders
2016-12-28 17:47:18 -08:00
arvidn 192ef4962b simplify the buffer_allocator_interface 2016-12-26 08:36:50 -08:00
arvidn 3f612d7e99 cleaning up of left-overs from torrent eviction functionality 2016-12-23 06:06:59 -05:00
arvidn bbfe58d03c fix bind-to-device for UDP sockets 2016-12-10 18:18:54 -05:00
Alden Torres 4142dfe5eb headers and code cleanup in udp_socket code 2016-12-06 22:54:29 -05:00
Steven Siloti b9169609df support separate external ip for each interface (#1383)
support separate external ip for each interface
2016-12-04 15:58:51 -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
Steven Siloti 06c53a41d1 revisions based on code review
Moved the logic to determine which sockets to keep to a separate function and
add unit tests for it.

Store the port which was originally specified for a listen socket so that we
can match sockets reliably even with port retries.
2016-11-23 01:09:05 -05:00
Steven Siloti babb93fb1e keep old listen sockets if they're still valid
This is to support multi-home. We need to be able to keep track of which socket
a DHT node or UTP connection should use. We also need to generate notifications
when local endpoints come and go so that the DHT tracker knows when to create
or delete nodes. The easiest way to do this is to keep the same socket for as
long as its local endpoint is valid. This way the nodes and connections can
simply reference the socket itself and generating notifications is trivial.
2016-11-23 01:09:05 -05:00
arvidn c9333849e6 deprecate relative times in torrent_status, replaced by std::chrono::time_point 2016-11-12 17:37:10 -05:00
arvidn 9e5a2a7de4 remove unused exceeded_cache_use() function 2016-11-07 13:07:46 -05:00
Steven Siloti e589e342ef reopen listen sockets when the system's IP changes (#1299)
reopen listen sockets when the system's IP changes. Only Linux and Windows supported for now.
2016-11-07 07:40:09 -05:00
Arvid Norberg b61ebca14a moved async-load-torrent feature out of disk-io-thread (#1282)
moved async-load-torrent feature out of disk-io-thread into a generic worker thread
2016-11-02 01:01:04 -04:00
Arvid Norberg 1c2a8fb96e move coalescing of reclaim block from disk_io_thread to session_impl (#1281) 2016-10-31 23:48:30 -04:00
Arvid Norberg 8daa200d11 simplify interaction with disk_io_thread by removing the uncork interface (#1271)
simplify the interaction with the disk_io_thread by removing the uncork interface. This should be turned into a transparent part of peer_connection instead and remove cork logic from peer_connection
2016-10-30 18:21:07 -04:00
Arvid Norberg 675d16a2c3 remove remainder of eviction/ghost torrent feature (#1251)
remove remainder of eviction/ghost torrent feature
2016-10-25 08:02:34 -04:00