Commit Graph

7496 Commits

Author SHA1 Message Date
arvidn 7538d68086 clean up integer_to_str() function 2018-11-17 17:21:06 +01:00
arvidn 66a8f133b0 merged RC_1_1 into master 2018-11-17 14:38:43 +01:00
arvidn 3126e8f39e improve type-safety a bit in the hole-punch code 2018-11-17 00:49:29 +01:00
arvidn e3c5b6c13c add rvalue ref overload of apply_settings() to avoid copying the whole settings_pack object 2018-11-17 00:44:25 +01:00
arvidn 7103b12cb7 remove typed_span type 2018-11-17 00:43:58 +01:00
arvidn 6381b35891 bump verson to 1.1.11.0 2018-11-16 15:52:16 +01:00
arvidn 1dc8c1c127 initialize bencoded ints with zero when constructed 2018-11-16 14:23:04 +01:00
arvidn 5383854768 make span's and sha1_hash's index and size types signed (instead of unsigned). Specifically std::ptrdiff_t. In line with the direction of gsl span and reduce signed->unsigned casts 2018-11-16 14:06:22 +01:00
arvidn 48980896d5 exit natpmp::on_reply earlier if we're shutting down 2018-11-16 10:14:37 +01:00
arvidn 5929ad4cae merge RC_1_1 into master (again) 2018-11-15 22:55:52 +01:00
arvidn 29cddaa23e merged RC_1_1 into master 2018-11-15 15:19:24 +01:00
airium 9415467dd8 Fix setting ipv6 interface 2018-11-15 13:12:22 +01:00
arvidn 164982c63a pass the dht item object by const reference instead of by value 2018-11-15 00:18:53 +01:00
arvidn 6d886f29a9 support moving the whole add_torrent_params object into the add_torrent call on session 2018-11-14 19:11:11 +01:00
arvidn 0c76a3a0c5 require tracker_request objects be moved into queue_manager. also replace non-const reference parameter with rvalue reference 2018-11-14 17:09:04 +01:00
arvidn 13dd7cfe1e a better fix to the ssl port announce bug 2018-11-14 07:36:22 +01:00
arvidn 437887ca37 pass add_torrent_params by const reference in deprecated add_magnet_uri functions. They are large to copy but since they're deprecated aren't worth the trouble of having an rvalue reference overload 2018-11-13 09:14:42 +01:00
arvidn 4d88c83576 add rvalue reference overloads for add_torrent_params, settings_pack and session_params. Those structures are pretty large so being able to take them by rvalue reference may be beneficial 2018-11-13 08:05:56 +01:00
arvidn 2d6a6a24ae move the whole add_torrent_params object into save_resume_data_alert 2018-11-13 01:03:16 +01:00
arvidn a233d3cc28 actually fix the issue with the second tracker announce with port 0 2018-11-12 18:02:15 +01:00
arvidn 2edb86c543 fix some warnings in utp_stream 2018-11-12 14:15:06 +01:00
arvidn 8d40cf6227 remove redundant MTU boundary checks 2018-11-12 14:08:00 +01:00
arvidn b731764c85 remove unused variables 2018-11-12 08:54:31 +01:00
arvidn 28d123ef23 factor out duplicate code in choker 2018-11-10 15:17:57 +01:00
arvidn 69485558ef factor out duplicate code in piece_picker, upnp and lazy_bdecode 2018-11-10 15:17:57 +01:00
arvidn 9d26f4f96c fix asio-debugging build of dht test 2018-11-09 16:39:39 +01:00
pavel.pimenov 0ad3bb139d fix cppcheck 2018-11-08 13:45:41 +01:00
arvidn a06a78ee1c fix of asio-debugging build in natpmp. resend_request could be called directly, not only as a handler for an async operation 2018-11-08 08:40:54 +01:00
arvidn 1f9e74f40d merged RC_1_1 into master 2018-11-06 23:57:04 +01:00
Arvid Norberg cec300234c fix move_storage with save_path with a trailing slash 2018-11-06 23:46:18 +01:00
arvidn 6be8b395da some cleanup turning memcmp() and memcpy() into span comparisons and std::copy(). some more use of random_bytes() instead of loops. 2018-11-05 18:52:45 +01:00
arvidn a0fa0b14bb merged RC_1_1 into master 2018-11-04 19:12:22 +01:00
arvidn bf496c6b14 use span for picker_log_alert 2018-11-03 11:56:09 +01:00
Arvid Norberg 939b380fda fix build against boost-1.69 2018-11-02 11:10:26 +01:00
Arvid Norberg 5b5b280b87 only make snubbed peers invert the piece picking strategy when we're doing rarest first (i.e. snubbed peers do common-first). Specifically, this prevents snubbed peers from picking from the end of the torrent when in sequential mode 2018-11-01 12:01:02 +01:00
arvidn d0e146eb75 merged RC_1_1 into master 2018-11-01 09:48:41 +01:00
Arvid Norberg e1eb12e60f ssl listen port fix and improved tracker announce logging 2018-10-29 18:38:14 +01:00
pavel.pimenov b00ce69d58 remove params.url.clear(); 2018-10-25 09:49:38 +02:00
Arvid Norberg a5da48edd4 add missing boost/noncopyable include 2018-10-25 09:47:21 +02:00
Amir Abrams 88266edd43 Update comment in put_mutable_item
Trivial update to a comment in put_mutable_item.
2018-10-24 13:13:20 +02:00
arvidn 3fb05d77d8 fix warnings 2018-10-20 20:56:26 +02:00
arvidn 36801fb96f add some const 2018-10-20 16:30:48 +02:00
arvidn 9463159e67 merged RC_1_1 into master 2018-10-20 00:22:10 +02:00
Arvid Norberg 12c52e8751 back-port the fix from the lgtm fixes in master 2018-10-19 19:40:17 +02:00
Arvid Norberg ede7dbf0aa add LGTM badge to README and fix warnings 2018-10-19 16:28:33 +02:00
arvidn 3b32c90dde fix gcrypt build 2018-10-17 10:14:14 +02:00
arvidn 269f0c5fb8 properly tear down the disk_io_thread object in set_piece_hashes() when exiting via an exception 2018-10-16 22:54:25 +02:00
arvidn 2d99e994c3 make throwing versions of read_resume_data 2018-10-07 12:41:53 +02:00
Arvid Norberg 1a27ff7107 parse_magnet_uri simplification 2018-10-05 11:01:45 +02:00
Arvid Norberg 761384bcf1 minor piece picker cleanup 2018-10-05 10:58:09 +02:00
Arvid Norberg a4267d61e7 fix overflow in sliding_average in the case of very high download rates 2018-10-03 00:53:05 +02:00
Arvid Norberg 949867eca9 factor out some parts of print function for entry 2018-10-03 00:50:02 +02:00
Arvid Norberg d2f19a2d73 merged RC_1_1 into master 2018-10-01 16:34:21 +02:00
Arvid Norberg 200bb494c3 bump version 2018-10-01 09:41:37 +02:00
arvidn c437a24d78 renamed debug_notification to connect_notification 2018-09-28 17:28:34 -07:00
arvidn a499ace80b fix issue in udp_socket with unusual socket failure 2018-09-28 13:17:43 -07:00
arvidn 109db58641 merge RC_1_1 into master 2018-09-25 21:33:29 -07:00
arvidn 022a089b86 utp close-reason use after free fix 2018-09-23 08:24:54 -07:00
Arvid Norberg 6724c1eec0 fix some warnings 2018-09-19 22:12:45 -07:00
Arvid Norberg 8be9b3d976 merged RC_1_1 into master 2018-09-19 12:23:08 -07:00
Arvid Norberg 81356cfce1 add make_tcp() and make_udp() to convert endpoint types 2018-09-19 10:57:28 -07:00
Steven Siloti c5b415b89f remove dead code udp_tracker_connection::pick_target_endpoint
Endpoints are filtered by address family in name_lookup() so this
function will always return the first endpoint.
2018-09-16 12:07:52 -07:00
Alden Torres e2a8fbf020 cleanup of special code for valgrind 2018-09-12 07:49:11 -07:00
arvidn 8cc93e9855 fix redundant flushes of partfile metadata 2018-09-12 07:47:13 -07:00
arvidn 16249b8135 fix overflow in calc_bytes(), add more tests, fix bug in piece picker accounting of filtered pad blocks. 2018-09-09 20:17:32 -07:00
Arvid Norberg fc7b61a6f3 improve type-safety of the severity parameter to peer_connection::disconnect() 2018-09-06 16:42:04 -07:00
Alden Torres 9b2f6042bb more use of index range and lint oriented refactor in torrent.cpp 2018-09-05 22:32:58 -07:00
arvidn c9cbb122e2 fix some warnings from sonar-cube 2018-09-05 18:10:57 -07:00
arvidn 78a344bd8b merged RC_1_1 into master 2018-09-05 08:25:14 -07:00
Steven Siloti a9bccceccd fix seed count when attaching a peer is aborted 2018-09-04 13:45:13 +02:00
Arvid Norberg 51003d11ca add assert to storage 2018-09-04 13:44:24 +02:00
Arvid Norberg 2647ca2412 add option to ignore min-interval from tracker, when force-reannouncing a tracker 2018-09-04 08:46:24 +02:00
arvidn 214ace3efe raise default value for active_limit to 500, since it's supposed to be an upper sanity check limit 2018-09-02 19:25:06 +02:00
arvidn 2e313de898 remove unused member variables in torrent object 2018-08-29 15:01:40 +02:00
Alden Torres b660e526b1 fixed old-style-cast warning when using libgcrypt 2018-08-28 21:03:55 +02:00
arvidn 7c837be651 make the print function for entry actually be json-like. when logging bencode entries, print it all on a single line. add test for entry print function 2018-08-27 13:56:04 +02:00
arvidn 269b71324e improve log statement when not unchoking a peer 2018-08-27 13:43:48 +02:00
Arvid Norberg c1b0c70c23 fall back to copy+remove if rename_file fails 2018-08-27 12:30:47 +02:00
arvidn 55215742af merged RC_1_1 into master 2018-08-25 14:13:51 +02:00
Arvid Norberg 6e80f1f615 improve handling of filesystems not supporting fallocate() 2018-08-22 08:35:22 +02:00
Arvid Norberg 11a8f46921 add some noexcept and assume std::function is not nothrow move constructible on clang 2018-08-21 11:12:34 +02:00
arvidn 37d85ac2f7 improve piece picker performance in tracking pad-blocks 2018-08-20 17:13:20 +02:00
arvidn c9043dec53 force proxy no longer disables the DHT 2018-08-20 08:24:31 +02:00
Alden Torres 28c94b54ed minor code refactor for more use of const and emplace 2018-08-20 08:06:37 +02:00
arvidn 058419a77c simplify total_have/have_want/total_want. make piece_picker track pad blocks and compute byte-progress at block granularity 2018-08-19 22:21:24 +02:00
Arvid Norberg b90564d418 remove the IPv6 enable/disable build config 2018-08-19 22:20:54 +02:00
Arvid Norberg fef1b947f3 fix issue in self-connection detection introduced with the change to generate unique peer-ids for each connection. Now, the torrent keeps track of all of our peer-ids generated for outgoing (bittorrent) connections, and we check them against incoming peers' peer-ids 2018-08-19 22:19:53 +02:00
Alden Torres 6a13d14f11 more use of const modifier 2018-08-15 07:41:41 +02:00
arvidn 6620b6e774 dial back the connect boost a bit from recent update 2018-08-13 19:17:01 +02:00
arvidn b3dbce5790 merge RC_1_1 into master 2018-08-13 09:32:17 +02:00
arvidn d55200af9d minor simplification of bytes_left(), remove quantized_bytes_done() 2018-08-11 08:29:45 +02:00
d_komarov 0bcf6cef23 Fix exporting files
To avoid overwriting existing files, before exporting anything from a
parts file, check whether it contains valid data.
2018-08-10 20:21:29 +02:00
arvidn 6d2541f131 improve connect-boost feature, to make new torrents quickly connect peers 2018-08-09 20:12:56 +02:00
arvidn 7be9547817 add a few more stats counters measuring outgoing connection attempts. simplify session_stats_header_alert by posting it on first call to post_session_stats() instead of making it gated by the alert_mask 2018-08-09 20:10:35 +02:00
Arvid Norberg 0a5b3c1bb0 update documentation for save_resume_data() and stop_when_ready() 2018-08-09 00:57:21 +02:00
arvidn f1d2105afb remove dead code from piece picker 2018-08-08 23:41:46 +02:00
arvidn 51fb1e3d6b tweak the auto-cache-size logic to have slightly smaller cache 2018-08-06 14:06:32 +02:00
arvidn c426ba88d4 fix buffer offset bug recently introduced to disk_io_thread::do_read() 2018-08-06 13:16:41 +02:00
arvidn 3416da41d9 fix narrowing warning 2018-08-03 21:02:44 +02:00
Arvid Norberg 6caddf6b8e fix deprecation of mmap_cache 2018-08-03 12:51:04 +02:00
arvidn 70d64327fd bump checking_mem_usage to be higher than the default in the high_performance_seed preset 2018-08-02 23:15:51 +02:00
arvidn 5f7252b32b add missing increment of on_disk_counter and num_blocks_hashed counters 2018-08-02 23:15:00 +02:00
arvidn 3de4e42fb7 slight cleanup of the ephemeral flag passed to add_web_seed() 2018-08-01 12:02:51 +02:00
arvidn 4096085bf8 merged RC_1_1 into master 2018-07-30 13:44:44 +02:00
arvidn 19df645012 apply piece priorities immediately, even though file priority updares are async. save both file- and piece priorities in fast resume. when loading, apply file prios first, then piece prios 2018-07-29 21:53:01 +02:00
Arvid Norberg a477a53b80 simplify natpmp gateway and local address discovery 2018-07-29 13:10:36 +02:00
Steven Siloti 92f1937b97 fix typo in #if tests for TORRENT_DISABLE_ENCRYPTION 2018-07-29 09:04:16 +02:00
Arvid Norberg b3856d3027 narrow the scope affected by TORRENT_DISABLE_EXTENSIONS to only disable the user extensions, but always support the extension message and the built-in extensions, like lt_donthave and seed_mode 2018-07-26 09:31:49 +02:00
Arvid Norberg 8f0cf7e1a9 some refactor to reduce duplicate code 2018-07-25 18:48:34 +02:00
Arvid Norberg 4282dd072a factor out generate_peer_id into its own file 2018-07-25 08:49:18 +02:00
arvidn a1f2995716 add piece index range checks on have_piece() and read_piece() 2018-07-25 00:20:18 +02:00
arvidn 730ef15b08 minor cleanups 2018-07-24 16:34:46 +02:00
arvidn c2ebae7dbb make metric_type_t an enum class, deprecate the in-class enum values 2018-07-24 15:29:56 +02:00
Arvid Norberg dcb8b816a3 only post alerts for newly opened listen sockets, and only attempt to map ports for newly opened sockets. track has_incoming_connections per listen socket 2018-07-23 15:04:23 +02:00
Arvid Norberg 2f56fa6c3e bump version to 1.1.9 2018-07-20 13:06:12 +02:00
arvidn f4b0dbf115 merged RC_1_1 into master 2018-07-20 09:28:21 +02:00
arvidn 1ebc5f9ef2 remove special handling of uTP peers 2018-07-20 07:47:08 +02:00
arvidn 9f6f23068c make natpmp deal with address_v6 instead of the bytes_type, and use write_address instead of memcpy 2018-07-20 07:46:12 +02:00
arvidn e92cf18340 fix some warnings around unused variables, dead stores, potentially dereferencing nullptr and calling virtual functions from constructor 2018-07-20 01:03:16 +02:00
arvidn d8755066e8 give some magic numbers names 2018-07-20 00:58:34 +02:00
arvidn a7b7623f23 return values instead of using out-params 2018-07-19 23:58:36 +02:00
Arvid Norberg 828c5dd097 merged RC_1_1 into master 2018-07-19 14:37:22 +02:00
Arvid Norberg 5bb5ba145f fix exporting files from partfile while seeding 2018-07-18 10:56:24 +02:00
Arvid Norberg e88a9a4dda merged RC_1_1 into master 2018-07-18 10:48:36 +02:00
arvidn 5d3ac8ff5c fix some warnings 2018-07-18 10:38:45 +02:00
arvidn f89c27183b remove unused function 2018-07-18 09:18:09 +02:00
Alden Torres d9d387d711 minor code cleanup, more use of const (#3174)
* minor code cleanup, more use of const, using u literal per lint

* revert use of unsigned literal

* reverted loop change
2018-07-16 18:23:38 +02:00
arvidn 4aa3c4573a use the strong type for pause flags 2018-07-16 12:06:21 +02:00
arvidn 4633258fbe make the DHT announce flags a strong type 2018-07-16 12:04:16 +02:00
Steven Siloti e5be30157f set port in handshake based on source address (#3172) 2018-07-15 21:15:04 +02:00
arvidn 52af3eaa7f simplify preadv and pwritev emulation functions 2018-07-14 09:03:15 +02:00
Andrei Kurushin 7a34b27499 fix Windows "file::preadv" emulation EOF handling 2018-07-12 23:54:34 +02:00
Andrei Kurushin 5399a14027 Windows async read EOF handling (#3162)
fix Windows "file::preadv" emulation EOF handling
2018-07-12 23:30:50 +02:00
arvidn 7ce20fd9d0 fix bug in read/write resume data functions. add proper tests 2018-07-12 23:19:08 +02:00
arvidn 59343f4f95 merged RC_1_1 into master 2018-07-12 20:20:02 +02:00
d-komarov 490d8eb328 Fix previous patch fixing deadlock in DllMain (#3158)
Simplify `get_manage_volume_privs()` and renamed it
2018-07-12 16:46:36 +02:00
arvidn 37a6a47ea3 minor cleanups around saving resume data 2018-07-12 08:38:53 +02:00
Steven Siloti 76ef8b9d72 simplify SSL torrent announce flags logic 2018-07-12 08:36:57 +02:00
Steven Siloti 28b6f64c4b dht: don't set implied_port for SSL torrents 2018-07-12 08:36:57 +02:00
Steven Siloti 961cf62cad dht: announce with per-interface listen port 2018-07-12 08:36:57 +02:00
Alden Torres 965ca9a565 avoid copy of arrays in dht alerts constructors 2018-07-09 19:53:35 +02:00
Arvid Norberg e317c72db3 merged RC_1_1 into master 2018-07-08 18:52:13 +02:00
arvidn 3c2b076eb0 deprecated anonymous_mode_alert 2018-07-08 18:26:47 +02:00
arvidn b750b6cc2c deprecate (and disable) the force-proxy setting. Instead, always use the proxy when set, never fall back on circumventing it 2018-07-08 18:26:47 +02:00
arvidn 2ba0e5ae2c move the file priority vector throught the disk_io_job, to avoid copies 2018-07-08 18:25:06 +02:00
arvidn d2d35b69fd raise priority of cache_flushed_alert and post it unconditionally when triggered explicily by the client 2018-07-08 18:23:44 +02:00
arvidn e45df614fe improve type safety of internal leave_seed_mode() function 2018-07-08 17:32:50 +02:00
Alden Torres 6d2f804d9f code refactor related to the use of index_range and end index 2018-07-08 17:32:30 +02:00
arvidn 0659a929af fix some validation issues in read_resume_data() 2018-07-08 17:32:14 +02:00
Arvid Norberg b60912569f back-port resume data validation fixes 2018-07-08 17:31:29 +02:00
Arvid Norberg 3fede4b223 merged RC_1_1 into master 2018-07-08 11:55:32 +02:00
arvidn efe3036879 clean up proxy_settings constructors 2018-07-07 18:02:43 +02:00
arvidn b5cd959dd1 bump the minimum number of hash jobs per thread from 2 to 4 2018-07-07 18:02:24 +02:00
d_komarov 1c86e94de6 Fix deadlock when loading libtorrent Dll
Definition of `bool file::has_manage_volume_privs` involves a call to
`get_manage_volume_privs()`, causing restricted tasks to be performed
from within `DllMain` function. They introduce possibility that client
application deadlocks or crashes.

You should never perform the following tasks from within DllMain:

* Call `LoadLibrary` or `LoadLibraryEx` (either directly or indirectly).
  This can cause a deadlock or a crash.

* Call the registry functions. These functions are implemented in
  'Advapi32.dll'. If not initialized before your DLL, it can access
  uninitialized memory and cause the process to crash.
2018-07-07 18:00:07 +02:00
Arvid Norberg c7e705e158 merged RC_1_1 into master 2018-07-07 13:33:15 +02:00
arvidn 3249b70cbd fix recent patch to support setting file priorities on torrents that don't have metadata yet 2018-07-07 11:34:11 +02:00
arvidn b76c149bdc use std::aray for the temporary buffer in socks5 UDP socket 2018-07-04 08:17:35 +02:00
d-komarov 6d5a6f05ad Fix torrent files prioritization (#3133)
After setting file priority, any subsequent attempt to set different priorities will fail if there is a `file_priority` job running in in disk thread. This happens because `torrent::m_file_priority` is being updated before adding disk thread job. The problem is gone if the file priority vector owned by the torrent object, is modified in the `torrent::on_file_priority` callback, when disk job finishes.
2018-07-04 08:16:33 +02:00
arvidn 10deff2f91 fix some unintentional copies (with explicit moves) 2018-07-01 18:22:32 +02:00
arvidn d439c8729a qualify some assignment operators to disallow assignment to temporaries 2018-07-01 17:29:50 +02:00
Alden Torres 2c5da2778a more lint oriented code refactor/cleanup 2018-06-29 13:27:29 +02:00
arvidn 4576723090 bump version to 1.1.8 2018-06-25 12:25:11 +02:00
Arvid Norberg ab56bf964f fix missing move of file object in part_file 2018-06-24 21:34:56 +02:00
arvidn b67166b29d merged RC_1_1 into master 2018-06-24 17:59:28 +02:00
Arvid Norberg 78d9c284e9 use more threads when creating torrents 2018-06-24 16:49:57 +02:00
Arvid Norberg 56a25ce280 bump checking_mem_usage default setting 2018-06-24 07:44:58 +02:00
Arvid Norberg b0b1bfb7a9 enable coalesce_reads and coalesce_writes by default on windows 2018-06-24 07:39:59 +02:00
Alden Torres be78a43d05 more use of empty(), emplace_back, const and auto in disk_io_thread code 2018-06-24 07:02:17 +02:00
arvidn 2cb29f88ac merged RC_1_1 into master 2018-06-23 23:22:26 +02:00
Alden Torres f139afc1ad minor code refactor, cleanup and typo in peer related code 2018-06-23 23:11:48 +02:00
Steven Siloti b7f230316c set the minimum number of checking jobs based on the number of hasher threads
To effectively mask the latency of generating more hash jobs there need to be
at least two jobs in-flight for each hasher thread.
2018-06-23 23:10:55 +02:00
arvidn 1e3a7cf0f4 fix hash-job fast-path 2018-06-23 23:08:58 +02:00
arvidn 16b32741ce fix coalesce read bug 2018-06-23 21:46:52 +02:00
arvidn 7ca769884c merged RC_1_1 into master 2018-06-22 08:33:44 +02:00
arvidn 0c147164bc introduce a fast-path for the hash disk job 2018-06-20 01:00:16 +02:00
arvidn f5a2015302 merge RC_1_1 into master 2018-06-19 22:26:01 +02:00
arvidn 4ae262d2d4 fix race condition in part_file 2018-06-19 14:50:02 +02:00
d-komarov 81ce7aa4ab Fix parts file i/o errors (#3110)
Since i/o operations are not synchronized, it is possible that one thread closes file handle, opened in another thread. With addition of `hidden` file attribute, an old bug in `part_file::open_file()` revealed both problems, causing a lot of random i/o errors in parts file. Fixing `open_file` bug should reduce the number of such errors back to 'normal'.
2018-06-18 14:34:39 +02:00
Alden Torres 03971be80b some refactor, more use of auto and const in peer_connection.cpp (#3105) 2018-06-16 17:22:04 +02:00
Alden Torres dfe47aa2a9 fixed sign implicit conversion warnings in new enum_net code (#3107) 2018-06-16 15:19:02 +02:00
arvidn 5530793c75 improve the API for iterating over all files and pieces, with the new strong index types. 2018-06-12 11:44:29 +02:00
Alden Torres a2ea79de4e minor code refactor in utp related code, more use of const 2018-06-12 11:41:32 +02:00
Arvid Norberg b26467c04e deprecate network-threads setting 2018-06-10 19:34:07 +02:00
Arvid Norberg 6647b0988d
add support for multi-home NAT-PMP and PCP 2018-06-10 16:55:42 +02:00
Steven Siloti 247672820c report transport version in NAT-PMP send/receive logs 2018-06-09 16:40:46 -07:00
arvidn e7fe7f1b89 fix boost::get<> invocation for variant 2018-06-10 00:56:55 +02:00
Steven Siloti f039cffeb3 relax packet length check prior to checking response code
Don't assume that an unsupported version response will contain anything past
the response code.
2018-06-09 08:55:49 -07:00
Alden Torres a357e490ed minor code refactor, more use of auto 2018-06-08 21:56:06 +02:00
Steven Siloti fbaa1afd62 return a vector of mapping ids from add_port_mapping 2018-06-07 18:18:31 -07:00
Steven Siloti e523566622 add support for the Port Control Protocol (PCP) 2018-06-07 18:18:31 -07:00
Steven Siloti f6720e31ed don't re-map all listen sockets when changing listen_interfaces
New sockets will be mapped regardless of the remap parameter. Requesting
full re-mapping just creates unecessary network traffic.
2018-06-07 18:16:08 -07:00
Steven Siloti 78be52112f create a natpmp instance for each listen socket 2018-06-07 18:16:08 -07:00
Steven Siloti 496cf46b25 enum_routes fixes on Linux 2018-06-07 18:09:51 -07:00
Steven Siloti 4a578b1450 fix scope_id in enum_routes on Windows 2018-06-07 18:09:51 -07:00
Steven Siloti 72cf4fd9ea Remove UNC prefixes from device names on Windows 2018-06-07 18:09:51 -07:00
Steven Siloti 603e206f36 fix netmask of routes on Windows
The build_netmask function was incorrectly dividing the size of the bytes_type
by 8. Also use b.size() instead of sizeof for consistency.

I'm not 100% certain what the difference between DestinationPrefix.PrefixLength
and SitePrefixLength is. It looks like SitePrefixLength is something specific to
site-local addresses. Emperically I found DestinationPrefix.PrefixLength
contains reasonable values while SitePrefixLength is always zero.
2018-06-07 18:09:51 -07:00
Arvid Norberg e88339378c merged RC_1_1 into master 2018-06-07 00:30:23 +02:00
Arvid Norberg 049d867c12 fixed race condition in random number generator 2018-06-06 09:54:49 +02:00
Arvid Norberg 2408200475 fix race condition in stat_cache 2018-06-05 19:07:33 +02:00
Arvid Norberg 794ccf4f79 remove unused disk stats counters 2018-06-05 19:03:04 +02:00
arvidn 267ca40b28 merged RC_1_1 into master 2018-06-02 13:15:13 +02:00
arvidn c55bc7dd42 improve error handling of failing to change file priority 2018-05-31 00:47:17 +02:00
Alden Torres 8a0ac58658 some lint oriented refactor, more use of const 2018-05-30 23:52:28 +02:00
arvidn c56f6abf72 deliver notification of alerts being dropped via alerts_dropped_alert 2018-05-30 11:26:02 +02:00
Alden Torres f9b43f3511 some cast cleanup, const modifier and lint refactor 2018-05-30 00:06:52 +02:00
Alden Torres 6c4869f044 moved instantiate_connection to aux namespace 2018-05-29 09:25:25 +02:00
Steven Siloti 396c5dd3af remove use of deprecated function readdir_r
Ports 140b8ace onto RC_1_1 branch
2018-05-28 16:06:41 +02:00
arvidn 3b0ce8d2e1 merged RC_1_1 into master 2018-05-28 15:56:22 +02:00
Alden Torres d6cecee8c0 some code cleanup and minor refactor 2018-05-24 23:46:37 +02:00
arvidn 6ec6c1b340 since moving an existing file into the part file isn't supported, just don't use the partfile for existing files when their priority is set to 0 2018-05-24 23:45:28 +02:00
arvidn 534276e7a5 refactor to use the utility function for bind_socket_to_device() instead of using the bind_to_device socket option directly, to make it best effort. include operation enum in udp_error alert. 2018-05-23 12:11:04 +02:00
Alden Torres ff300ed224 some cleanup and refactor in torrent_info code (#3054) 2018-05-23 10:39:55 +02:00
arvidn 77191a3820 fix hidden attribute in file class 2018-05-23 10:39:10 +02:00
arvidn ed8fffc1a6 set the hidden attribute when creating the part file 2018-05-23 10:39:10 +02:00
arvidn 55a0a6e0df fix production asserts 2018-05-22 12:12:33 +02:00
Steven Siloti 92a7188163 only start a new accept request on new listen sockets
Existing sockets already have an outstanding accept.
Also fix mapping new listen sockets when re-mapping is not requested.
2018-05-22 11:06:33 +02:00
arvidn 1a66a8b285 merged RC_1_1 into master 2018-05-20 12:08:46 +02:00
arvidn c986d93913 fix properly ignoring failure to get local endpoint of a socket while printing an error 2018-05-20 10:47:46 +02:00
Steven Siloti 54f00ce09d don't change state to downloading if the torrent is finished
Move the transition to downloading after the torrent has been checked
for being finished. This prevents a spurious state_changed_alert when
adding a torrent which is already completed.

Also move the posting of the torrent_checked_alert to maintain the
historical ordering of that alert with respect to the transition out of
checking_resume_data.
2018-05-20 08:45:24 +02:00
Steven Siloti 9a48ef761e fix address of point-to-point interfaces (#3039) 2018-05-17 00:54:46 +02:00
Alden Torres 7621be6df1 fixed signed/unsigned warnings with latest version of Xcode clang (#3032) 2018-05-16 16:06:33 +02:00
Alden Torres a14d595eac minor code cleanup in torrent.cpp 2018-05-16 16:05:15 +02:00
Alden Torres a7b2026ef8 minor code refactor in ip_filter code 2018-05-14 23:58:01 +02:00
Arvid Norberg f4d7ff592e merged RC_1_1 into master 2018-05-14 09:50:10 +02:00
Arvid Norberg ccdfd7383e move export.hpp into aux_ folder. put assert symbols in libtorrent namespace 2018-05-14 09:09:01 +02:00
Arvid Norberg 17055ad4d1 don't enable reuse-address for UDP sockets, as it will always succeed and not get any incoming packets. It's better to detect a port conflict and try a different port. Also implement port-retry logic for the UDP sockets 2018-05-13 22:36:02 +02:00
Steven Siloti 243353a144 account for partially downloaded pieces when announcing as a seed 2018-05-13 22:35:04 +02:00
arvidn fe612ca167 replace the TORRENT_CFG ABI check with inline namespaces around the symbol that can change ABI based on build configuration options 2018-05-13 19:25:17 +02:00
arvidn 9ca12d6db5 restore aspects of the previous behavior of force-proxy. Instead of not opening any TCP listen sockets at all, open them but reject any incoming connection. This is because in RC_1_1, the UDP and TCP sockets are tied in subtle and unintuitive ways. This is much cleaner in the next major release and this patch will not need to be merged 2018-05-13 12:31:00 +02:00
arvidn 8bb1cd2b46 merged RC_1_1 into master 2018-05-12 15:37:53 +02:00
d-komarov f052d1ca40 Fix bandwidth allocation (#2810)
Don't allow peer connection to ask quota from bandwidth manager if send buffer is empty.
Remove undefined member function
Update download rate multiplier
2018-05-12 13:53:03 +02:00
arvidn ddd1168296 don't attempt to make uTP connections if we don't have any outgoing UDP sockets 2018-05-12 13:34:58 +02:00
arvidn 4d17e0132e fix empty outgoing interfaces for UDP sockets 2018-05-12 13:34:58 +02:00
Steven Siloti 8fdba2aa39 don't specialize standard type trait is_integral
Concerning type traits, the C++ standard states: "The behavior of a program
that adds specializations for any of the templates defined in this subclause is
undefined unless otherwise specified."

There is no exception for is_integral.
2018-05-10 19:06:18 +02:00
arvidn 299a545648 add test for suggests- and seed mode combined 2018-05-10 17:40:23 +02:00
Steven Siloti 96d215a32a only allow pinged nodes into the routing table (#3006)
This is an attempt to prevent bogus nodes entering the routing table and
being propogated to other nodes.
2018-05-08 12:47:29 +02:00
Eugene Shalygin 81fd09775c Fix compilation with GCC 8 2018-05-07 13:33:18 +02:00
Arvid Norberg 4b368e1cfc merged RC_1_1 into master 2018-05-02 01:57:41 +02:00
arvidn 8808eb7cdd introduce a recursive mutex to protect the alert_manager, and hold the mutex while calling user callbacks and plugin hooks. This is required to ensure the underlying storage for alert allocations (in the stack allocators) is synchronized with the thread that may be accessing it 2018-05-01 23:17:51 +02:00
Alden Torres 8da635d1f5 minor code cleanup, more use of const 2018-05-01 23:03:29 +02:00
Alden Torres 377e800e72 fixed conversion warnings in 32 bits 2018-04-30 23:09:00 +02:00
Steven Siloti ec18742f8e save the number of idle threads locally in disk_io_thread_pool::thread_active
This cuts down on the number of atomic loads while also being more correct.
Before it was possible for m_num_idle_threads to increase before its value
could be stored in m_min_idle_threads.
2018-04-29 16:31:18 +02:00
arvidn 8621477239 merged RC_1_1 into master 2018-04-28 14:36:24 +02:00
Steven Siloti f5e33932d2 fix use after free in flush_range and flush_iovec
Calling blocks_flushed can cause the piece entry to be freed so its
callers need to be aware of that and avoid dereferencing the pointer if
the entry is freed.
2018-04-27 16:15:19 +02:00
Arvid Norberg 366b7983d1 fix typo with bind_outgoing_socket~ 2018-04-26 19:50:25 -04:00
pavel.pimenov 2a97ec6e0e Windows: Fix build Visual C++ ARM/ARM64 2018-04-25 16:07:47 -04:00
Alden Torres 0ec66e9024 fix disk_io_thread::do_check_fastresume storage initialize logic from RC_1_1 merge 2018-04-25 16:04:20 -04:00
Alden Torres 83dd6c9c53 cleanup and refactor in storage source code 2018-04-25 16:02:30 -04:00
Arvid Norberg b4d2281e53 honor torrent abort even on file check error 2018-04-24 23:14:48 -04:00
Xiyue Deng 21d8e9e26b Add missing header <cstdarg> for va_list.
* Fix building on OpenBSD.
2018-04-24 23:09:25 -04:00
arvidn 3ede0b9c20 fix last_upload, last_download and last_scrape to be reported accurately and saved/restored in resume data 2018-04-22 06:14:22 -04:00
Alden Torres d34973def9 minor code cleanup in disk buffer code 2018-04-21 23:48:40 -04:00
Arvid Norberg d8c022070f merged RC_1_1 into master 2018-04-21 17:17:55 -04:00
TheOriginalWinCat bcb9e4546f Use settings_pack::urlseed_wait_retry for default retry with http seeds. (#2948)
Update documentation
2018-04-21 18:36:56 +02:00
d-komarov 44479bcca3 Fix storage initialization (#2944)
If `default_storage::has_any_file` fails during fastresume data check, `piece_manager::check_no_fastresume` will skip storage initialization. In such case, any storage operation that require part file will cause an application crash.
2018-04-21 18:35:55 +02:00
arvidn 52e1a7b6c9 merged RC_1_1 into master 2018-04-15 11:00:57 +02:00
arvidn 9cd0ae67e7 another boost-1.67 build fix 2018-04-13 14:43:41 +02:00
Alden Torres 791a1e8557 minor code refactor and a few const in torrent.cpp 2018-04-13 14:17:02 +02:00
arvidn f0227451a6 merged RC_1_1 into master 2018-04-13 01:47:41 +02:00
Steven Siloti 236e0e7699 pass default constructed boost::function instead of NULL
Clang 6 defines NULL as nullptr which breaks implicit construction
of boost::function from NULL.
2018-04-12 14:32:31 +02:00
Alden Torres 9b1e79660f removed unnecessary parentheses around min/max, added some const modifier (#2926) 2018-04-11 15:19:00 +02:00
arvidn aaf9304a3b update year in copyright header 2018-04-09 09:04:33 +02:00
arvidn 105934e578 bump version 2018-04-08 23:08:39 +02:00
arvidn c5a5e084dd :strtoll() returns LLONG_MAX if the input overflows. Handle this case properly in the http parser 2018-04-08 18:34:25 +02:00
arvidn a7406de2b8 remove the global cache of the current time, just use clock::now() instead 2018-04-07 21:43:18 +02:00
V.G. Bulavintsev c08a6bf430 Make SACK header to be able to take up the whole packet. Rename m_in_buf_size to m_receive_buffer_capacity 2018-04-07 18:55:14 +02:00
V.G. Bulavintsev 257f625e2e Increase m_in_buf_size and max_packet_reorder to better handle links with high latency 2018-04-07 18:55:14 +02:00
V.G. Bulavintsev bf2f0a9c55 Fix advertised window being counted twice in congestion check 2018-04-07 18:55:14 +02:00
Fernando Rodriguez 9d83da110b Delay hash_failed_alert until on_piece_sync()
Delay the hash_failed_alert until after synchronizing with the IO thread
so that it can be used to synchronize piece progress.
2018-04-07 15:59:40 +02:00
Alden Torres d6edf26e11 minor code tidy 2018-04-07 00:30:36 +02:00
Alden Torres 2d9bff0877 make socket_entry buffer std::array 2018-04-06 10:04:32 +02:00
Arvid Norberg 6efff919cd deprecated alert::progress_notification alert category, split into finer grained categories 2018-04-05 16:27:28 +02:00
gubatron 2a82bb5880 disk_io_thread abort_hash_jobs duplicate code refactor 2018-04-05 16:01:30 +02:00
Arvid Norberg 357217326d some cleanups 2018-04-05 12:59:35 +02:00
arvidn 32b2de8f17 merged RC_1_1 into master 2018-04-04 20:48:07 +02:00
Alden Torres 0d9862a8dd fix wrong variable name 2018-04-04 19:41:03 +02:00
Arvid Norberg 16f1deb3ec merged RC_1_1 into master 2018-04-04 15:28:33 +02:00
Arvid Norberg a5e0578c88 fix part-file header allocation 2018-04-03 20:46:49 +02:00
Arvid Norberg 77102102d6 simplify some for-loops in xml_parse 2018-04-03 18:45:04 +02:00
Arvid Norberg 49ae7858a8 fix potential fd leak in enum_net_interfaces 2018-04-03 13:44:33 +02:00
arvidn 98d5313598 don't perform DNS lookups for the DHT bootstrap unless DHT is enabled 2018-04-01 23:53:12 +02:00
Alden Torres 5b922072e9 avoid calls to .address() when looking for endpoint protocol (#2892)
using is_v4 and is_v6 where possible
2018-04-01 13:48:17 +02:00
arvidn 6a2df1034a add some asserts and checks preventing IPv6 addresses to make it into libtorrent when IPv6 support is disabled 2018-03-31 14:17:06 +02:00
Alden Torres 1f06a6684c avoid calling address to test protocol, more consts and minor lint oriented code changes 2018-03-29 12:20:59 +02:00
Alden Torres f963f2c726 minor lint oriented code refactor 2018-03-28 15:55:05 +02:00
Alden Torres 90e4cefa91 removed unnecessary loop in request_a_block 2018-03-28 15:54:50 +02:00
arvidn d080c6f532 merged RC_1_1 into master 2018-03-26 12:56:25 +02:00
d_komarov 1c867a5026 Changing file priorities while checking interrupts checking.
Also, if the last file has zero priority, checking is interrupted prematurely.
2018-03-26 02:59:10 +02:00
arvidn 0fa24faec4 merged RC_1_1 into master 2018-03-25 22:06:41 +02:00
arvidn 02a01fa22e fix issue where the current tracker would be skipped for the next tracker in the same tier 2018-03-25 14:40:38 +02:00
arvidn 67bbb82122 improve type-safety in piece picker, by introducing a type for download queue index, for pieces 2018-03-24 23:03:09 +01:00
arvidn 3171245292 fix warnings 2018-03-24 23:01:19 +01:00
Alden Torres f94a8169fc added some const in bandwidth_limit.cpp 2018-03-24 22:59:54 +01:00
Alden Torres 9cab4d7d31 using move with bw_request and make sure it is movable 2018-03-24 10:48:16 +01:00
arvidn 9df4d4b7f8 replace typedef with using. replace NULL with nullptr. cleanup page_aligned_allocator 2018-03-23 11:19:46 +01:00
Alden Torres 7a477cd938 more use of move and code refactor in bandwidth related code 2018-03-22 18:01:01 +01:00
arvidn 82f87b0655 remove redundant check in tracker announce. This is checked in http_tracker_connection 2018-03-21 23:38:10 +01:00
Alden Torres 6b35ebb9ad some code refactor and cleanup in broadcast_socket 2018-03-21 23:37:52 +01:00
Alden Torres 4bfa920fe7 refactor in macro conditions for helper_getauxval to avoid unused function warning in android x86 2018-03-21 13:45:28 +01:00
Alexandre Janniaux 3efb81e50c add windows socket libraries in Makefile.am 2018-03-21 13:44:59 +01:00
arvidn 8a85e1c01a merged RC_1_1 into master 2018-03-21 12:17:11 +01:00
arvidn 7dad0db4a5 fix warnings in bdecode and disk_io_job 2018-03-20 12:43:44 +01:00
arvidn 09bf97b79e minor fixes in utp_socket_impl 2018-03-18 17:03:05 +01:00
Alden Torres 61ae2c834b removed unused bt_peer_connection::on_keepalive 2018-03-16 17:32:20 +01:00
arvidn 4b144ba451 merged RC_1_1 into master 2018-03-16 13:16:45 +01:00
arvidn 0edb0f28c1 stat files in the disk thread, in default_storage::initialize() instead of the constructor 2018-03-15 14:54:49 +01:00
Alexandre Janniaux 4f7b683eb0 fix if defined TORRENT_ANDROID
Fix malformed TORRENT_ANDROID macroprocessor tests, related to #2831
2018-03-14 09:32:18 +01:00
arvidn 8658fb5f7c deprecate the error_file_* constants whose underlying features have been deprecated 2018-03-13 19:39:55 +01:00
Alexandre Janniaux f8889858f6 dynamically load getauxval so as to support older android devices 2018-03-12 09:11:01 +01:00
arvidn 5c1b65e9b8 merged RC_1_1 into master 2018-03-12 02:32:12 +01:00
arvidn a06e4f696b track whether a file is eligible for using the partfile on a per-file basis. This is intended to improve backwards compatibility, to better support resuming files downloaded with older versions of libtorrent 2018-03-11 12:52:56 +01:00
Alexandre Janniaux 2bc2f3af0f Add missing define for old android sdk (#2831)
define NETLINK_NO_ENOBUFS and IFA_D_DADFAILED if they don't exist
2018-03-09 22:37:21 +01:00
arvidn 05f7a95604 fix reporting &redundant= in tracker announces 2018-03-08 02:11:46 +01:00
Alden Torres 1f86beb253 ask for protocol instead of copy address in ut_pex_peer_store::was_introduced_by 2018-03-07 09:44:45 +01:00
Steven Siloti 5478f57e43 fix windows build with UNC paths disabled 2018-03-06 08:48:19 +01:00
Alden Torres 135e47c929 minimal optimization by using node_id::is_all_zero 2018-03-05 09:01:25 +01:00
Alden Torres 448de4ca14 more use of emplace_back in chained_buffer 2018-03-04 11:34:24 +01:00
Alden Torres 80f5edc500 added some static and const in node.cpp and minor cleanup in rpc_manager.cpp 2018-03-02 11:29:59 +01:00
arvidn 9696082355 merged RC_1_1 into master 2018-02-25 09:36:12 +01:00
arvidn 24dea1f845 fix tie-break in duplicate peer connection disconnect logic 2018-02-21 21:04:28 +01:00
arvidn e81eaf5935 minor cleanup in uTP code 2018-02-21 10:07:22 +01:00
Alden Torres 2ac84ed5f5 minor code cleanup in http_tracker_connection code 2018-02-21 09:23:03 +01:00
arvidn 53b4725da3 clean up noexcept specifiers to adapt to what the implementation provides 2018-02-20 08:43:52 +01:00
Arvid Norberg eec34e3ac3
fix issue with SSL tracker connections left in CLOSE_WAIT state (#2797) 2018-02-20 08:40:47 +01:00
d-komarov f94b62acf7 CMake improvements
CMake build scripts improved to simplify configuring and building of
project and tests.

Better use of compile definitions by replacing add_definitions with
target_compile_definitions. Use INTERFACE, PUBLIC and PRIVATE keywords
to separate scope of TORRENT_BUILDING_SHARED and TORRENT_LINKING_SHARED
definitions.

* Move tests to the separate file - test/CmakeLists.txt
* Fix use of compile definitions
* Remove redundant tailqueue.cpp
2018-02-19 23:23:15 +01:00
Alden Torres 421709f67f added friendly_name and description to ip_interface (#2799) 2018-02-19 11:46:35 +01:00
arvidn 1ede34da8a undo the patch to restore incoming TCP connections over SOCKS5 2018-02-19 00:01:42 +01:00
arvidn f8fb5c2294 merged RC_1_1 into master 2018-02-10 22:52:12 +01:00
arvidn a1860426b8 defer truncating existing files until the first time we write to them 2018-02-10 18:33:41 +01:00
arvidn 77181c1469 fix issue when receiving a torrent with 0-sized padfiles as magnet link 2018-02-09 17:41:30 +01:00
Alden Torres d2e874fca8 headers code cleanup, removed unused fields in torrent class (#2775) 2018-02-06 08:32:19 +01:00
arvidn 15a8a17a6f merged RC_1_1 into master 2018-02-05 08:55:15 +01:00
arvidn a0a63341c7 fix haiku build 2018-02-04 19:10:43 +01:00
Alden Torres 3261eea63a more use of emplace and minor code refactor in bt_peer_connection.cpp 2018-02-02 21:53:48 +01:00
Alden Torres fe9883ea27 avoid endianness test in peer_priority function 2018-01-31 22:49:25 +01:00
arvidn 91e03c789c fix issue resuming 1.0.x downloads with a file priority 0 2018-01-31 22:43:07 +01:00
Alden Torres 5d230a69f2 minor code cleanup 2018-01-30 12:38:08 +01:00
arvidn 01c41fadcf fix torrent_status::next_announce 2018-01-29 15:08:18 +01:00
arvidn 50a293730b merged RC_1_1 into master 2018-01-29 10:20:45 +01:00
arvidn e126d7bce0 move socket_type into aux-namespace 2018-01-29 08:33:45 +01:00
arvidn 9ac394f5b0 turn piece picker option flags into a proper type 2018-01-29 03:01:17 +01:00
arvidn a33c81ad33 shave down session_interface by one function, reduce the dependencies between torrent and session 2018-01-29 03:00:59 +01:00
arvidn ca3ea591df fix pad-file scalability issue 2018-01-29 03:00:37 +01:00
arvidn 720bfa54cd merged RC_1_1 into master 2018-01-29 01:20:08 +01:00
arvidn b729021625 make coalesce-buffers work on windows and systemps with pwritev()/preadv() 2018-01-28 23:05:01 +01:00
arvidn a50579c651 merged RC_1_1 into master 2018-01-27 09:41:54 +01:00
Alden Torres 084e980d52 avoid repeated calls to .address(), minor refactor 2018-01-27 09:22:38 +01:00
d-komarov fa03cbea9b Revise torrent state update
* Remove unused m_in_state_updates
* Update m_state_subscription comments
2018-01-27 09:17:40 +01:00
arvidn 308cbfe097 merged RC_1_1 into master 2018-01-27 02:36:55 +01:00
arvidn bc4d53c71f restore support for incoming connections over SOCKS5 (disabled by default) 2018-01-25 09:14:14 +01:00