Commit Graph

1190 Commits

Author SHA1 Message Date
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
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
Arvid Norberg 8cf6e9e37c use span<> to return the block_info for a piece (#1777)
use span<> to return the block_info for a piece to improve range checks and loops
2017-03-04 23:45:07 -05:00
Alden Torres 3a93e1767b fixing sign issues in peer_connection::send_allowed_set 2017-02-24 22:21:14 -05:00
arvidn 2c51c59327 merge RC_1_1 into master 2017-02-18 13:29:12 -05:00
Alden Torres a670871519 fix build from RC_1_1 merge 2017-02-17 19:06:51 -05:00
arvidn 7b61313b99 fix invalid access when leaving seed-mode with outstanding hash jobs 2017-02-17 15:37:56 -05:00
Pavel Pimenov 7f4c8aaf75 Add const peer_request p -> peer_request const& p (#1705)
Add const peer_request p -> peer_request const& p
2017-02-14 00:17:02 -05:00
Alden Torres 1f72843fe3 fixing sign-conversion warnings, part 13, minor refactor (#1675)
fixing sign-conversion warnings, part 13, minor refactor
2017-02-07 23:36:13 -05:00
arvidn 34ecb60c09 use enum class for close reason 2017-02-04 11:24:35 -05:00
Alden Torres 4c487ec47c using std:: for integral types 2017-02-03 22:15:47 -05:00
arvidn c8e488b094 merged RC_1_1 into master 2017-02-02 22:58:33 -05:00
Arvid Norberg 4733670aa1 fix issue where num_seeds could be greater than num_peers in torrent_status (#1645)
fix issue where num_seeds could be greater than num_peers in torrent_status
2017-02-01 01:39:09 -05:00
arvidn 17ee28d176 Merge branch 'master' of https://github.com/arvidn/libtorrent 2017-01-28 14:36:28 -05:00
arvidn 6b91adab6a merged RC_1_1 into master 2017-01-28 14:36:23 -05:00
Alden Torres 3803661863 moved alloca.hpp to private aux_ and size refactor (#1634)
moved alloca.hpp to private aux_ and size refactor
2017-01-27 12:43:34 -05:00
arvidn cca5ab8368 fix integer overflow 2017-01-26 23:39:56 -05:00
arvidn 0c7e86078b merged RC_1_1 into master 2017-01-08 10:18:41 -05:00
arvidn 39866c2306 fix division by zero when setting tick_interval > 1000 2017-01-07 15:21:02 -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
arvidn 5a97af54db optimize chained buffer a bit and factor out nop into non_owning_handle 2016-12-29 07:05:18 -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
Alden Torres 75f307c187 minor cleanup and refactor in peer connection 2016-12-22 17:48:47 -05:00
Arvid Norberg 3f1084d63d strengthened type safety in handling of piece and file indices (#1409)
strengthened type safety in handling of piece and file indices
2016-12-22 10:42:33 -05:00
arvidn a2c4e7490e merged RC_1_1 into master 2016-12-20 01:16:13 -05:00
Alden Torres f382936d56 headers, end of file, code cleanup 2016-12-12 23:36:45 -05:00
Alden Torres d9f8d4b642 refactor to more use of auto c++11 keyword (#1404)
refactor to more use of auto c++11 keyword
2016-12-11 20:50:30 -05:00
Alden Torres dd7179fb10 added a few consts to arguments and local variables 2016-12-10 18:19:14 -05:00
Alden Torres 7266b0b360 fixing shorten-64-to-32 warnings, part 4 2016-12-09 17:24:07 -05:00
Steven Siloti 30303c17df don't indicate interest in peers when in upload only mode
If the torrent is paused we don't want to mark peers as interesting
even if the torrent has not finished downloading.
2016-12-09 17:16:25 -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
Arvid Norberg 15ab8f387b cleaning up of disk_interface and improving type safety (#1353)
cleaned up disk_interface and improved type safety. removed unused disk status code disk_check_aborted, and removed status code return value for async_hash
2016-11-26 01:51:47 -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
arvidn 1d5f42d6d0 convert remaining disk io jobs 2016-11-23 19:02:05 -05:00
arvidn fc9dabe1ab start chipping away at removing disk_io_job from the disk_interface 2016-11-23 19:02:05 -05:00
arvidn 0e33e62627 merged RC_1_1 into master 2016-11-20 11:18:16 -05:00
arvidn d5b76d2237 move block_cache_reference out of disk_io_job header 2016-11-20 10:34:42 -05:00
arvidn 35126576ca remove use of disk_io_job from buffer_holder 2016-11-20 10:34:42 -05:00
arvidn 5b3a730b1f steps towards removing disk_io_job from disk_interface 2016-11-20 10:34:42 -05:00
tnextday b25ea5329f updates `m_last_sent` in `peer_connection::setup_send()` instand of `peer_connection::keep_alive()` 2016-11-19 02:03:12 -05:00
arvidn 3ff89f29d7 remove explicit ticking of storage from the torrent. instead make the disk_io_thread do it automatically 2016-11-06 10:26:10 -05: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 5341be1e84 more improvement to error/exception handling (#1247)
improvement to error/exception handling
2016-10-22 22:00:47 -04:00
Steven Siloti a6e5ba8804 return a span from TORRENT_ALLOCA (#1244)
return a span from TORRENT_ALLOCA

Unfortunately this requires moving the variable declaration inside the macro.
Due to alloca’s unique properties pretty much the only safe way to call it is
in a simple assign-to-pointer expression. Therefor we need to use a temporary
pointer to store the value returned from alloca before we can call span’s ctor.

This also causes double evaluation of the size parameter which is unfortunate,
but no current callers of TORRENT_ALLOCA have a problem with this. Passing
expressions with side effects to macros is bad mojo anyways.
2016-10-22 14:43:40 -04:00
Arvid Norberg c18c12a144 remove ghost torrent/torrent eviction feature. (#1214)
remove ghost torrent/torrent eviction feature. It was very complex and did not solve the problem very well
2016-10-15 13:32:59 -04:00
Arvid Norberg 20f65946f2 make single-argument constructors explicit (#1194)
make single-argument constructors explicit
2016-10-08 14:07:11 -04:00
Arvid Norberg 7a52a285a1 back-port error_code cleanup from master (#1173)
back-port error_code cleanup from master
2016-10-03 16:32:40 -07:00
Arvid Norberg 8bb7aa62ae generalize and improve http redirect support for web seeds (#1060)
generalize and improve http redirect support for web seeds
2016-10-02 23:08:03 -07:00
Arvid Norberg cebd976cc2 fix error_code vs. error_condition traits (#1169)
fix error_code vs. error_condition traits. deprecate get_*_category(), instead use *_category()
2016-10-02 12:27:50 -07:00
Arvid Norberg f592d7fcb0 various cleanup and formatting updates (#1158) 2016-09-26 20:05:04 -04:00
Arvid Norberg 9cebd4569f general cleanup of disk_buffer_holder and tailqueue (#1156)
general cleanup of disk_buffer_holder and tailqueue
2016-09-26 14:22:38 -04:00
Arvid Norberg 97c6a75084 add proper error handling to peer connections and session (#1149)
add proper error handling to peer connections and session. i.e. catch exceptions in asio handlers and catch by const reference
2016-09-25 09:50:48 -04:00
Arvid Norberg 372d992d8e make connection_type enum an enum class (#1146) 2016-09-24 10:47:17 -07:00
Arvid Norberg d2002c5248 separate piece_block and has_block out to their own headers (#1148) 2016-09-24 08:46:56 -07:00
Alden Torres acf353e26a general session, torrent and peer connection log optimization (#1088)
general session, torrent and peer connection log optimization
2016-09-13 22:46:07 -04:00
Alden Torres 224ebc1ded peer_connection log related optimization (#1086)
peer_connection log related optimization and making m_alert_mask atomic
2016-09-13 17:07:22 -04:00
Alden Torres 01e9810f7a more boost types cleanup and handling of deprecated macos libcrypto (#1072)
more boost types cleanup and handling of deprecated macos libcrypto. more granular TORRENT_MACOS_DEPRECATED_LIBCRYPTO
2016-09-07 17:51:18 -04:00
Alden Torres e11f233086 minor cleanup/refactor (#1062) 2016-09-04 18:24:20 -04:00
Alden Torres 728e74eca7 refactor to avoid use of optional with piece_block_progress (#1061) 2016-09-04 12:31:02 -04:00
Arvid Norberg 19dd9d323a add some const and enum class (#1055) 2016-09-02 08:27:38 -04:00
Arvid Norberg 5f5589d137 deprecate and remove remote_dl_rate feature (#1051)
deprecate and remove remote_dl_rate feature
2016-09-01 09:43:08 -04:00
Alden Torres bf0008933a refactor to use std::shared_ptr with peer_connection, core and tests (#1050) 2016-08-31 21:42:18 -04:00
Alden Torres cdb15ba886 refactor to use std::shared_ptr with torrent (#1048) 2016-08-31 08:27:36 -04:00
Alden Torres cfd2caeb74 no more extension_list_t type and uncommented call to torrent_plugin::on_load (#1042) 2016-08-30 17:36:44 -04:00
Alden Torres 2ac45d17ef ed25519 api refactor (#1041) 2016-08-30 02:37:51 -04:00
Arvid Norberg 9ac7475a90 simplify some constructors with in-class initializers (#1038)
simplify peer_connection, torrent and session_impl's contstructors by moving simple parts to their header files
2016-08-29 20:29:27 -04:00
Alden Torres 118e30fd86 minor cleanup/refactor (#1036) 2016-08-28 00:04:16 -04:00
Alden Torres 00510d2b06 more use of span and std::shared_ptr (#1018)
more use of span and std::shared_ptr
2016-08-21 13:37:11 -04:00
Alden Torres 7cee486cf7 extensions refactor to use span and std::shared_ptr (#1005)
extensions refactor to use span. use std::shared_ptr instead of boost::shared_ptr.
2016-08-17 14:30:24 -04:00
Alden Torres 9b0bc2ed5f peer_plugin refactor (#1002)
refactor of ut_pex peer storage
2016-08-15 21:05:39 -04:00
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 83dba91168 use span for to_hex and from_hex functions 2016-07-29 18:42:18 -04:00
Alden Torres 98918d61f5 removed const_interval, mutable_buffer and const_buffer types (#956)
removed const_interval, mutable_buffer and const_buffer types
2016-07-27 22:31:08 -04:00
Alden Torres ddb274751f using span in crypto_plugin encrypt/decrypt (#934) 2016-07-23 15:54:39 -07:00
Alden Torres f57612b82d rename of aux::array_view to span (#933) 2016-07-22 09:31:42 -07:00
Arvid Norberg 7bf49c0a1c modernize hasher to use array_view (#931)
modernize hasher to use array_view as well as adding array_view support to entry
2016-07-22 07:29:39 -07:00
Arvid Norberg e72f95e0d9 fix test_remap_files (#905)
fix test_remap_files
2016-07-15 14:35:57 -04:00
Arvid Norberg 0a3cb77d23 deprecate and remove guided read cache (#904) 2016-07-10 19:25:26 -04:00
Arvid Norberg 8c03718117 apply modernization transforms to headers too. nullptr, explicit constructors, = default (#903) 2016-07-10 14:27:42 -04:00
Arvid Norberg 770935cd46 modernize-use-nullptr (#894) 2016-07-09 16:26:26 -04:00
arvidn 76bb6db1ab fixup 2016-07-09 02:34:50 -04:00
Steven Siloti e0c0b14e6c limit crypto messages to 1MB (#884)
limit crypto messages to 1MB
2016-07-04 02:48:13 -04:00
Arvid Norberg 44c048f4f5 fix seed mode and suggest mode (#871)
fix resume data when combining seed-mode with suggest-mode
2016-07-02 16:20:12 -04: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
arvidn 08aebd2729 format more log messages in alert constructors 2016-06-29 02:02:46 -04:00
arvidn b1e36a53e3 print peer logs directly into the allocation 2016-06-29 02:02:46 -04:00
Arvid Norberg a675682b6c some cleanup of TORRENT_DEBUG defines (#863)
some cleanup of TORRENT_DEBUG defines
2016-06-27 22:28:51 -04:00
Arvid Norberg 31b2a03005 some optimizations (#858)
allow disk I/O callback objects to be moved into disk io jobs
2016-06-27 01:02:00 -04:00
Arvid Norberg c567a66f5e simplify peer_connection's read handlers and the receive buffer. (#853)
simplify peer_connection's read handlers and the receive buffer. removed the concept of soft-packet-size. removed the secondary null-buffer receive path. removed try_read. simplify the buffer class to not be resizeable. make receive_buffer shrink the buffer allocation. add cap to growing the receive buffer. buffer sizes are always divisible by 8.
2016-06-26 20:41:03 -04:00
arvidn 263bd31782 merged RC_1_ into master 2016-06-26 18:07:21 -04:00
arvidn b97ac65c01 don't perform expensive hash of piece data for logging 2016-06-26 13:11:52 -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 a9dbbdea37 use array_view instead of std::vector in crypto_plugin interface (#835)
use array_view instead of std::vector in crypto_plugin interface. return a vector of const_buffers for prepending new buffers. use stack allocated (single buffer) iovecs for receives. general cleanup
2016-06-19 23:05:59 -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
Alden Torres efa8bb0fc7 making disk_buffer_holder internal and include cleanup (#827)
making disk_buffer_holder internal and include cleanup
2016-06-17 17:40:22 -04:00
Arvid Norberg 4d927f4029 modernize disk_buffer_holder to be move-only (#824)
modernize disk_buffer_holder to be move-only
2016-06-16 08:24:41 -04:00
Arvid Norberg c0fb61c5d7 replace the suggest-read-cache logic with something much simpler (#815)
replace the suggest-read-cache logic with something much simpler that doesn't schedule regular jobs and doesn't query the disk cache
2016-06-15 13:29:54 -04:00
Arvid Norberg ce161a9d62 remove option to disable contiguous receive buffers (#818)
removed option to disable contiguous receive buffers
2016-06-15 08:04:53 -04:00
arvidn 4b186130e6 fix merge 2016-06-14 21:16:28 -04:00
Arvid Norberg 4e0a4db9b4 fixed inverted priority of incoming piece suggestions (#809) 2016-06-12 20:36:05 -04:00
arvidn dfc2206b9f merged RC_1_1 into master 2016-06-11 01:00:41 -04:00
Arvid Norberg 5ecd00c5c5 fix osx build (#804)
fix osx build with asserts enabled
2016-06-11 00:48:13 -04:00
Arvid Norberg 327af3a69e optimize allow-fast logic (#800)
optimize allow-fast logic
2016-06-10 01:24:37 -04:00
Arvid Norberg 404d72b9b7 revert handshake round-trip optimization (#797)
revert handshake round-trip optimization. it prevents taking advantage of FAST extensions since the bitfield is sent before receiving the other peer's handshake
2016-06-10 01:14:37 -04:00
Arvid Norberg 830a79dbcf optimize allow-fast logic (#800)
optimize allow-fast logic
2016-06-09 08:02:41 -04:00
Arvid Norberg 5eaf713d1f revert handshake round-trip optimization (#797)
revert handshake round-trip optimization. it prevents taking advantage of FAST extensions since the bitfield is sent before receiving the other peer's handshake
2016-06-07 21:45:48 -04:00
Arvid Norberg 8c8f5bb03b deprecated public to_hex() and from_hex() functions (#784) 2016-06-04 10:01:43 -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 748af6eec1 general cleanup. remove valgrind markup, log_hash_failures and C headers (#752)
general cleanup. remove valgrind markup, log_hash_failures and C headers
2016-05-23 08:15:39 -04:00
arvidn aa0d29b67d merged RC_1_1 into master 2016-05-19 01:28:22 -04:00
Arvid Norberg e8380e1d0b factor out includes from config.hpp into the files actually using it. primarily, printf family of functions, since C++11 version is used now. This removes the need for an snprintf-wrapper on windows (#732) 2016-05-17 09:24:06 -04:00
Arvid Norberg 4057aa0391 fix issue with comparison of cached time and real-time (#719) 2016-05-09 08:21:00 -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
Arvid Norberg 0d2c04cb2e remove network thread pool feature (#688)
remove network thread pool feature (it was messy and mostly useful for bittorrent over SSL). The proper solution is to allow every peer run in its own asio strand and have multiple threads running the io service
2016-05-02 02:18:51 -04:00
Steven Siloti ff0675e64e use standard array container (#676) 2016-04-30 23:10:47 -04:00
Arvid Norberg 10ec0234a7 remove resolve-country feature (#656) 2016-04-28 08:20:47 -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
Arvid Norberg c9c6dd2d3b clean up the annotations used for asio debugging (#639)
clean up the annotations used for asio debugging (tracking outstanding async operations)
2016-04-23 17:29:25 -04:00
Andrei Kurushin 7b5d48c02a fix default release build with VS2015 UP2 compiler warnings (#624)
* fix default release build with VS2015 UP2 compiler warnings
this will allow to successfully build:
bjam toolset=msvc-14.0 release deprecated-functions=off character-set=unicode link=static warnings-as-errors=on
2016-04-17 16:56:07 -04:00
Steven Siloti 9ffadcde62 allow peers to resume allocating disk buffers when their last outstanding write completes 2016-04-09 16:48:05 -07:00
arvidn 3e7a6b03e5 remove dead code in peer_connection 2016-03-21 18:47:17 -04:00
arvidn 85cf5ac195 remove unused aligned_holder class. fix logging issue of out-of-bound piece requests 2016-03-19 23:32:50 -04:00
arvidn 317eb2fe2a remove unused disk allocation code 2016-03-16 20:13:28 -04:00
arvidn 08bac479be allow each peer have at least 2 allocated disk blocks at any given time, to avoid stalling when cache_size setting is small. also deprecate use_write_cache 2016-03-16 00:28:11 -04:00
arvidn 58e73c1469 fix typo 2016-03-13 20:47:50 -04:00
arvidn 8f14c74be8 fix issue where a seed could time-out an unchoked peer for not sending any requests, despite being busy servicing requests from the peer (and time out immediately when m_requests is drained) 2016-03-13 16:41:31 -04:00
arvidn 2178d1ad2b improve robustness and performance of uTP PMTU discovery. fix duplicate ACK issue in uTP. demote an invariant check to 'expensive' 2016-03-13 12:40:59 -04:00
arvidn b9ec183e24 increase default connect speed. minor cleanup. add logging for short lived connections 2016-03-03 01:20:15 -05:00
arvidn 88b7e3768f add sim test for optimistic unchoke round-robin distribution 2016-02-01 20:28:30 -05:00
arvidn efe32c6a0e rewrite most of web_peer_connection::on_receive to make it a lot simpler and fix edge cases with pad-files 2016-01-28 01:58:33 -05:00
arvidn 1f9f588e75 merge copyright year update and changelog from RC_1_0 2016-01-17 18:57:46 -05:00
arvidn 645b121df6 deprecate resolve-countries 2015-12-14 21:32:30 -05:00
arvidn d505f93d7a port sim tests to use the new setup_swarm API 2015-12-12 00:41:47 -05:00
arvidn cc3b064cff fix graceful pause issue. peers regularly check whether they should disconnect or not 2015-12-04 23:27:43 -05:00
arvidn e9c0fc8eb5 fix bug that disabled rarest-first piece picking. introduced when removing speed-affinity in the piece picker 2015-11-29 08:26:00 -05:00
arvidn fd3b53604c add new piece picker logging alert category 2015-11-29 08:25:55 -05:00
arvidn a8e31fd8ca add first coverage of test_transfer as a proper sim 2015-11-28 00:59:39 -05:00
arvidn a138b2daa9 handle receiving an invalid request 2015-11-07 14:58:08 -05:00
arvidn 5da511f140 now that force-started torrents aren't affected by the auto-manager, they need to be explicitly kicked when entering checking state (it would be nice if all this could be done through set_state()) 2015-09-29 20:49:38 -04:00
arvidn c0a4f7ba26 fix super seeding assert (forward port from RC_1_0) 2015-09-08 18:17:13 -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
arvidn beb5455331 add disk I/O read asserts and fix i2p issue if a tracker responds with i2p peers when i2p is not configured on the client 2015-08-28 07:20:21 -04:00
arvidn 6012306557 add more asserts for the size of the bitfields peers send 2015-08-27 21:48:52 -04:00
arvidn a42f9e0c63 fix more warnings 2015-08-22 00:28:12 +02:00
arvidn 4873004df7 warnings as errors 2015-08-21 14:52:07 +02:00
arvidn ffa870d280 fixed some GCC warnings 2015-08-20 01:33:20 +02:00
arvidn 5c8fc818c1 fix more warnings 2015-08-19 01:39:01 +02:00
arvidn f6b86dc4b5 add typesafety to piece_picker torrent_peer pointers. and fix a few incorrect uses 2015-08-18 04:25:13 -04:00