Commit Graph

2165 Commits

Author SHA1 Message Date
arvidn 1a66a8b285 merged RC_1_1 into master 2018-05-20 12:08:46 +02:00
d_komarov 96700c15ff Set http request timeout to 5 seconds
Fixes random test failures in test_http_connection.
2018-05-17 00:54:12 +02:00
Eugene Shalygin a626f75c5e Refactor CMakeLists.txt
1. Replace custom 'shared' option with the standard BUILD_SHARED_LIBS
flag
2. Replace foreach() calls for source items with target_sources() and
generator expression $<JOIN:>.
3. Remove build types definition: makes no sense for
single-configuration generators, and is populated automatically for
multi-configuration ones.
4. Add feature summary
5. Enahnce compiler flags management for static runtime by utilizing functions
from the ucm project
6. Copy almost all options from the Jamfile.
7. If compiler supports C++14, use it.
8. Raise minimum required CMake version to 3.11 and drop bundled FindIconv.cmake
2018-05-14 09:08:19 +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
Arvid Norberg c98b700d4f merged RC_1_1 2018-05-10 22:48:39 +02:00
arvidn a2c6136f44 add round-trip test to create_torrent 2018-05-10 19:04:26 +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
Arvid Norberg 26b0487f0b merged RC_1_1 into master 2018-05-01 21:26:42 +02:00
d-komarov 785f173df3 Revise alert priorities / torrent::on_resume_data_checked issue (#2962)
Most status alerts should have priorities above normal level. Good reason for this is resume data verification case. For a large torrent(having lots of pieces) whole alert queue will be overflowed
with a `piece_finished_alert` right after resume data has been verified. Thus alerts like `torrent_checked_alert`, `torrent_finished`, `state_changed_alert` will not go the alerts queue.
* Introduce alert_priority enumeration
* Bump state_changed_alert's priority
* Set dht_direct_response_alert priority to `critical`
2018-05-01 12:26:37 +02:00
Eugene Shalygin 049e918295 build python bindings with cmake 2018-04-29 19:48:26 +02:00
arvidn 8621477239 merged RC_1_1 into master 2018-04-28 14:36:24 +02: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
Arvid Norberg d8c022070f merged RC_1_1 into master 2018-04-21 17:17:55 -04: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 f0227451a6 merged RC_1_1 into master 2018-04-13 01:47:41 +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 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
Arvid Norberg 6efff919cd deprecated alert::progress_notification alert category, split into finer grained categories 2018-04-05 16:27:28 +02:00
arvidn 32b2de8f17 merged RC_1_1 into master 2018-04-04 20:48:07 +02:00
Arvid Norberg 77e473f35b fix ~peer_server() to not throw 2018-04-03 13:44:58 +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 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 3171245292 fix warnings 2018-03-24 23:01:19 +01:00
arvidn 5413eae900 declare tag types in-line 2018-03-23 11:21:08 +01:00
arvidn 9df4d4b7f8 replace typedef with using. replace NULL with nullptr. cleanup page_aligned_allocator 2018-03-23 11:19:46 +01:00
Steven Siloti e08ec99132 cmake: restore change to make test_common a propper library
This was originally done in 87832ce706 but
it got clobbered by a merge from RC_1_1.
2018-03-21 21:40:29 +01:00
arvidn 4e04e6993d boost::int64_t -> std::int64_t 2018-03-15 08:53:17 +01:00
arvidn 8658fb5f7c deprecate the error_file_* constants whose underlying features have been deprecated 2018-03-13 19:39:55 +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
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
d-komarov 3acc5732a2 Add file test workaround (#2804)
File test compiled with TORRENT_USE_UNC_PATHS produces file that cannot
be removed.
2018-02-21 12:29:37 +01:00
d_komarov eb9f7c488b Minor test changes
* Fix warning in test/CMakeLists.txt
* Fix router name check in test_upnp
2018-02-21 09:20:02 +01:00
d_komarov 0ecb935d9d Fix test/CmakeLists.txt not found on Linux
* Rename test/CmakeLists.txt -> test/CMakeLists.txt
* Revert accidentally removed processing of resolve-countries option
2018-02-19 23:23:15 +01:00
d-komarov b922ea86c9 Fix some tests
* Fix test_remove_torrent fails when torrent is downloaded too quick
* Fix typo when printing session alerts
* Fix test_lsd and test_upnp on multi-homed systems
* Fix test_tracker 'connect_alert' predicate
2018-02-19 23:23:15 +01:00
d-komarov 18a4f82b5c Fix test_transfer sync of torrent stats
Evaluate torrent total blocks count only once. Equalize synchronization
of 'disk.disk_blocks_in_use' check used to break cycle with TEST_CHECK
statement. This makes tests that refer to web seeds execute much faster.
2018-02-19 23:23:15 +01:00
d-komarov 41b3d437de Fix and improve setup_transfer
Numerous issues cause test fails on Windows(and Linux?). Most of them
found in print_alerts procedure.

Make print_alerts predicate check short-circuit, i.e. exit early on
first match. Fixes cases when appropriate variable may be re-assigned
multiple times with incorrect values.

Make stop_process wait until actual process successfully terminates.
This change is applicable to Windows only and helps to avoid tests
cleanup errors.

Make stop_proxy procedure do what it suppose to do. Previously it was
doing nothing with intention that all proxies are stopped after test
completion. Under Windows there are problems with proxy that has it's
socket connection abandoned. Thus failing the rest of test cases.

* Fix stop_all_proxies map using incorrect key to erase elements
* Fix wait_for_alert case with negative 'num'
* Make print_alerts predicate const& to avoid extra copy
* Make listen_alert and downloading_alert predicate procs reentrant
2018-02-19 23:23:15 +01:00
d-komarov 22e9370cb6 Fix exception when calling dup2 with -1 2018-02-19 23:23:15 +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
Alden Torres c50d6c9593 fixed possible division by zero and improved log output in swarm_suite 2018-02-17 17:18:32 +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
Alden Torres 2d3e394226 fixing warnings in tests code, part10, final 2018-02-02 20:59:01 +01:00
Alden Torres c5d62cf1ca fixing warnings in tests code, part9 (#2758) 2018-02-02 08:26:21 +01:00
Alden Torres 4abeacdf33 fixing warnings in tests code, part8 2018-01-31 01:14:23 +01:00
Alden Torres 73a7050185 fixing warnings in tests code, part7 2018-01-30 12:34:53 +01:00
Alden Torres 11aa4ee66a fixing warnings in tests code, part6 (#2745) 2018-01-29 12:40:44 +01:00
arvidn 50a293730b merged RC_1_1 into master 2018-01-29 10:20:45 +01:00
arvidn 348bc2b4fe remove some uses of memset in favour of std::array. add some noexcept to sha1_hash operations 2018-01-29 03:02:06 +01:00
arvidn 9ac394f5b0 turn piece picker option flags into a proper type 2018-01-29 03:01:17 +01:00
arvidn ca3ea591df fix pad-file scalability issue 2018-01-29 03:00:37 +01:00
arvidn f4de19fbff fix test_random to not use memset() 2018-01-28 19:33:02 +01:00
Alden Torres 070d1cd61f fixing warnings in tests code, part5 (#2736) 2018-01-28 00:56:21 +01:00
Alden Torres 6d5b90968b fixing warnings in tests code, part4 2018-01-27 09:18:26 +01:00
Alden Torres 8d379dd944 fixing warnings in tests code, part3 2018-01-25 09:09:21 +01:00
arvidn 4fef787212 merged RC_1_1 into master 2018-01-24 00:37:05 +01:00
Alden Torres 7262118177 fixing warnings in tests code, part2 (#2718) 2018-01-23 19:23:57 +01:00
arvidn efd096d879 use unique peer_ids per connection 2018-01-23 16:40:16 +01:00
Alden Torres 13e54a3da8 fixing warnings in tests code, part1 (#2700) 2018-01-19 22:40:39 +01:00
arvidn a01274ce2c broadcast socket handler take a span 2018-01-14 20:21:42 -05:00
arvidn e829c1942a merged RC_1_1 into master 2018-01-14 13:07:20 +01:00
arvidn a9085db760 fix error handling of merkle torrents 2018-01-13 17:33:36 -05:00
arvidn 65fef972a2 apply some c++11 modernization 2018-01-11 04:51:39 -05:00
arvidn a93429c5db modernize piece-size selection in torrent creator and add a test 2018-01-09 03:19:44 -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
arvidn 98419aee12 disable debug iterators in simulations on windows, since exception safety is compromised 2018-01-05 10:55:12 -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 70448a2c3a update libsimulator submodule 2018-01-02 18:42:01 -05:00
arvidn 17869828d7 don't redirect stderr by default, to get sanitizer output 2018-01-02 18:42:01 -05:00
arvidn 0eec9194db fix suppressing stderr redirection in tests, with the -n option 2017-12-28 17:54:23 +01:00
arvidn 7ea5946305 remove some last lexical_cast residual 2017-12-27 12:44:36 +01:00
arvidn 753826cbb8 merger RC_1_1 into master 2017-12-23 18:15:01 +01:00
arvidn 43d7f980d0 make the chunk header parser properly fail at end of buffer, and not require zero terminated strings 2017-12-23 17:06:50 +01:00
arvidn 62bf524e75 disable DHT logging with the TORRENT_DISABLE_LOGGING macros as well 2017-12-23 12:01:18 +01:00
arvidn b7decd452e add getters for peer_class_filter and peer_class_type_filter 2017-12-23 09:25:06 +01:00
arvidn bb945f5cf4 introduce a proper type for pex flags to improve type-safety 2017-12-17 23:17:12 +01:00
arvidn 4d32d45100 merged RC_1_1 into master 2017-12-16 14:21:22 +01:00
arvidn d52763805c back-port the tracker timeout test from master 2017-12-16 13:54:15 +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
arvidn ba224a1577 restore the parse_magnet_uri overload that amends an add_torrent_params object 2017-12-14 12:20:02 +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 b00b3184c0 some minor i2p cleanups 2017-12-08 09:57:21 +01:00
arvidn 90ccd5180f merged RC_1_1 into master 2017-12-07 18:31:16 +01:00
arvidn f81a20a035 fix loading resume data when in seed mode 2017-12-03 23:43:55 +01:00
arvidn 0fe2e85fee fix part-file creation race condition (back-port from master) 2017-12-03 18:13:54 +01:00
arvidn c16eb32b94 merge RC_1_1 into master 2017-12-03 18:12:35 +01:00
arvidn 5d28e0b76e reduce boilerplate in magnet link test 2017-12-01 20:40:50 +01:00
Alden Torres 163d13e1d2 implemented support magnet URI extension, select specific file indices for download, BEP53 (#2578) 2017-12-01 12:40:19 +01:00
arvidn 9d37fbd1f7 disable tests requiring logging when building with logging disabled 2017-11-24 07:50:06 +01:00
arvidn 4bc93cff38 merge RC_1_1 into master 2017-11-23 18:01:32 +01:00
arvidn 5e7666526e fix IPv6 tracker announce issue 2017-11-23 10:11:59 +01:00
arvidn d8ea7fc5eb merged RC_1_1 into master 2017-11-23 01:17:43 +01:00
arvidn 1593916e62 fix ipv6 udp tracker test 2017-11-23 00:05:08 +01:00
arvidn eac3fbceda fix stout redirection in test framework 2017-11-23 00:05:08 +01:00
arvidn 04c2c35f8d restore path sanitization behavior of ':' 2017-11-21 08:50:09 +01:00
arvidn 22f8bdfebc merge RC_1_1 into master 2017-11-21 00:50:02 +01:00
arvidn f262bbdcea use seconds32 as the retry-time for web seeds 2017-11-19 16:20:36 +01:00
arvidn 1c278cc697 add API to query whether alerts have been dropped or not 2017-11-11 15:42:53 +01:00
arvidn b88c193742 fix sign conversion warning in peer_class_type_filter 2017-11-11 09:17:37 +01:00
Pavel Pimenov 8ac6bbe553 add http_parser::header_int (#2472) 2017-11-09 23:43:26 +01:00
arvidn 381db57b42 improve simulations by reseeding the random number generator. also erase all output in between iterations in test_error_handling 2017-11-09 17:59:13 +01:00
arvidn f41d2b5d3b move shared_ptr instead of copying them, when constructing DHT observers 2017-11-08 23:09:43 +01:00
arvidn 7730eea401 restore backwards compatibility with the API before download_priority_t was introduced 2017-11-06 01:24:24 +01:00
arvidn d9de6767a7 back-port updated ssl test cert from master 2017-11-05 22:45:20 +01:00
arvidn a690e6c76d add throwing overload of parse_magnet_uri 2017-11-05 20:31:06 +01:00
arvidn 6785046c2f introduce a download_priority_t type, for uniform an type-safe piece- and file priorities 2017-11-02 08:20:21 +01:00
arvidn 505b388a36 regenerate ssl test certificates and keys 2017-11-01 18:43:00 +01:00
arvidn f57b90b500 introduce type for torrent queue_position 2017-11-01 10:52:45 +01:00
Alden Torres f02e7514e1 fix issue of null m_part_file in default_storage readv/writev (#2490)
call need_partfile if necessary in default_storage constructor and no .reset() in release_files()
2017-10-31 16:49:58 +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 50bef25786 make the piece-picker less two-phase initialized 2017-10-26 23:39:15 +02:00
arvidn 80ac90727b remove some questionable code from disk_io_thread when deleting files for a torrent and extend transfer test to cover deleting files while seeding 2017-10-25 19:00:54 +02:00
Alden Torres b380bf8059 minor and general code cleanup/refactor 2017-10-25 09:58:47 +02:00
Alden Torres 174a2ca65f add limit of max 50 upnp mappings and recover free global mappings (#2470) 2017-10-24 16:16:22 +02:00
arvidn a6c85496b5 make parse_magnet_uri return the add_torrent_params instead of of taking an in-out parameter 2017-10-15 04:29:53 +02:00
arvidn bb65acb082 make feature_flags proper type-safe 2017-10-14 23:33:48 +02:00
arvidn 8adcfdbf41 make disk_buffer_holder know the size of the bufer it holds, to fix buffer overrun in chained_buffer
fix
2017-10-13 21:07:31 +02:00
arvidn 85b6d98454 merged RC_1_1 into master 2017-10-11 11:19:02 +02:00
arvidn f19cca1374 fix infinite loop when parsing certain invalid magnet links 2017-10-11 09:11:58 +02:00
arvidn 9111d5977e make the variables holding the source of external IPs type-safe 2017-10-10 22:38:36 +02:00
Arvid Norberg 60b74d2616 merged RC_1_1 into master 2017-10-10 14:25:12 +02:00
Arvid Norberg 830ef0bedd prevent dependency on openssl from leaking outside of libtorrent (libssl and libcrypto should not be a usage requirement). This cleans up most tests to build without having to also link against openssl 2017-10-09 17:15:35 +02:00
arvidn 1d15e6bfb4 merge RC_1_1 into master 2017-10-08 18:21:25 +02:00
arvidn f080149081 fix parsing of torrents with certain invalid filenames 2017-10-08 15:54:08 +02:00
arvidn cdd9f91999 fix leak of torrent_peer objecs (entries in peer_list) 2017-10-07 11:43:42 +02:00
arvidn d0f55224fb simplify copy_ptr 2017-10-07 02:59:46 +02:00
arvidn 21fef88928 stricten up the filename sanitization a bit 2017-10-01 20:30:02 +02:00
arvidn c0d76a5304 fix regression in torrent size check 2017-10-01 16:44:58 +02:00
arvidn 33b03e1f8e improve handling of case where a torrent file has no files in it 2017-10-01 10:53:43 +02:00
arvidn 5026659cb6 clean up and fix edge cases in update_path_index 2017-10-01 04:43:41 +02:00
arvidn 17d78d3b8f fix bounds checking in parsing of gzip header 2017-10-01 03:33:38 +02:00
arvidn 9d276ada8a fix issue with the name in single file torrents being sanitized away 2017-10-01 01:12:39 +02:00
arvidn 12e92aeeb4 make the chunk header parser a bit more strict and accurate (and not rely on there being a 0 termiator character) 2017-09-30 11:59:00 -07:00
Arvid Norberg 61733787f7 fix redundant assert in gzip header check 2017-09-29 23:51:45 -07:00
arvidn 7444c12c6c upgrade test_bdecode to use the new bdecode API 2017-09-28 19:38:33 -07:00
arvidn 68f05d6380 fix some warnings and integer overflow with torrents that are too big 2017-09-28 14:59:28 -07:00
arvidn edad33d270 fix const correctness in get_peer_class 2017-09-24 14:49:55 -07:00
arvidn 4c4c630fae merge RC_1_1 into master 2017-09-23 10:46:29 -07:00
Steven Siloti 8648de3706 DHT nodes should only handle requests on their socket (#2355) 2017-09-21 21:00:38 -07:00
arvidn 9839507ecd simplify to_string to not apply unary - to an unsigned integer 2017-09-17 21:23:24 +02:00
arvidn 1a8660bca7 don't shadow static_category in alerts 2017-09-16 19:58:11 +02:00
arvidn 9f177ad413 analyze with sonarqube 2017-09-08 22:19:48 +02:00
arvidn e36b066020 make logging alerts enabled by default in autoconf builds 2017-09-05 09:21:08 +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 95c8c3018a use span in gzip, http_parser and http_connection 2017-09-04 22:33:38 +02:00
arvidn 53ff169db1 use string_view in find_metric_idx 2017-09-04 07:50:13 +02:00
Steven Siloti 5361ffc1c2 add_file_borrow: use string_view instead of pointer, size parameters (#2302) 2017-09-02 23:58:36 +02:00
arvidn 2025c15ec1 cleanup tokenize_string -> split_string 2017-09-02 07:46: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
Steven Siloti cc3f73de96 add span ctor from const containers (#2275) 2017-08-28 11:36:51 +02:00
Arvid Norberg d250ba5a17 wrap destination string in i2p_peer in string_ptr handler (#2268) 2017-08-25 09:42:46 +02:00
arvidn d59d394d5b remove residual mentions of mtu for interfaces 2017-08-20 22:34:20 +02:00
Alden Torres 66734e2e5b using if_indextoname instead of RTM_GETLINK to fill the interface name in enum_net_interfaces (#2253)
using if_indextoname instead of RTM_GETLINK to fill the interface name in enum_net_interfaces. removed IFA_LABEL switch case, removed ip_interface::mtu, master rebase
2017-08-20 10:55:59 +02:00
arvidn 05b5b4ef4d merged RC_1_1 into master 2017-08-16 22:46:47 +02:00
arvidn b5fe0f95a2 fix issue in UTF-8 encoding validation 2017-08-16 13:15:19 +02:00
arvidn b70d3efba9 fix infinite loop when parsing torrents whose filenames have zeroes. #2247 2017-08-16 07:21:34 +02:00
arvidn fcb9c7b6f3 fix invalid read in parse_int() in bdecode_node() and lazy_bdecode() 2017-08-15 00:01:37 +02:00
arvidn 865ff09a84 merge RC_1_1 into master 2017-08-10 16:44:57 +02:00
arvidn 560ef29276 fix issue with very long tracker- and web seed URLs. Instead of using a fixed length stack allocated request buffer, use a dynamically growing stringstream 2017-08-10 14:01:11 +02:00
arvidn 4e497e1383 fix issue where paths were not correctly coalesced when adding files to file_storage (used more memory than necessary) 2017-08-10 12:10:46 +02:00
arvidn bb6f2b9837 extend file_storage tests. Make pad files separate paths and file names properly 2017-08-10 01:33:35 +02:00
arvidn 378a0e974b fix issue of force-recheck or seeding from read-only media, torrents with empty files in them. Previously libtorrent would create empty files up-front unconditionally, now they won't be created if they already exist 2017-08-09 18:48:49 +02:00
arvidn 1f3730fa5a fix force-recheck issue (new files would not be picked up) 2017-08-06 09:49:51 +02:00
arvidn 5bf28e37b8 make create_torrent flags type-safe 2017-08-04 21:23:42 +02:00
arvidn a8a5986046 make file attributes (in file_storage) type safe 2017-08-04 07:38:57 +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 b38efb6c65 make alert category flags be a strong type 2017-07-26 07:20:47 -07:00
arvidn c4eb4c8b5f use span in torrent_info constructors and deprecate the redundant flags argument 2017-07-22 00:00:44 -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
arvidn 87ca4bb26f Fix bug where the resume data would fail to load the piece bitmask for seeds when suggest_cache was enabled 2017-07-21 19:06:02 -07:00
arvidn c4659bc345 convert peer_flags and peer_source_flags to type-safe flags 2017-07-17 10:22:32 -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
AllSeeingEyeTolledEweSew 00655d562b Refactor several flags to torrent_handle::get_flags/set_flags. 2017-07-17 01:05:31 -07:00
arvidn 73942de97a carve out peer_list_entry into also being deprecated (it was only used by deprecated functions and some tests) 2017-07-16 19:20:29 -07:00
toinetoine b1c3e12cd0 added block_uploaded_alert to allow client to track upload activity 2017-07-16 11:04:03 -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
arvidn 0f2af8c3ef disable msvc warning 4503 2017-07-13 22:24:29 -07:00
arvidn c692147c94 merged RC_1_1 into master 2017-07-13 19:55:29 -07:00
arvidn cc30434c52 fix inconsistency in file_priorities and override_resume_data behavior. file_priorities are not subject to the override_resume_data flag 2017-07-12 15:36:55 -07:00
pavel.pimenov a422af1a7b remove call _strchr
_TEXT	SEGMENT
_c$ = 8							; size = 1
?is_space@@YA_ND@Z PROC					; is_space, COMDAT

; 8    : 	static const char* ws = " \t\n\r\f\v";
; 9    : 	return strchr(ws, c) != nullptr;

	movsx	eax, BYTE PTR _c$[esp-4]
	push	eax
	push	DWORD PTR ?ws@?1??is_space@@YA_ND@Z@4PBDB
	call	_strchr
	add	esp, 8
	neg	eax
	sbb	eax, eax
	neg	eax

; 10   : }
2017-07-12 15:34:45 -07:00
d-komarov 85cf521145 fix bandwith rate limit calculation (#2134)
back-port of fc0cbfb789
2017-07-11 21:35:12 -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
arvidn 6425cfbc4f tests should not fail by failing to clean up. Make clean up more reliable on windows 2017-07-04 10:21:23 -04:00
Steven Siloti ec2fb91aa5 reject put messages with incorrect bencoding (#2118)
add function to check for soft bdecode errors. reject put messages with incorrect bencoding
2017-07-02 18:30:32 -04:00
arvidn 5c37eb174f drop support for windows compilers without std::string and wchar_t (believed to be old cygwin) 2017-07-02 08:24:55 -04:00
arvidn db09332a02 merged RC_1_1 into master 2017-06-30 08:58:21 -04:00
arvidn 3c8450d47c fix backwards compatibility issue when loading the torrent info dict from resume data 2017-06-29 15:03:49 -04:00
arvidn 506950001d fix regression where paused torrents could not have their queue position changed 2017-06-27 12:37:08 -04:00
arvidn 2b91b1070d merged RC_1_1 into master 2017-06-24 12:37:13 -04:00
Steven Siloti ec30a5e9ec fix out-of-bounds read in bdecode
Fixes #2099
2017-06-24 10:52:49 -04:00
arvidn b7642f75d5 move clear_bufs out of storage.cpp into storage_utils 2017-06-21 13:04:05 -04:00
arvidn aa842948a3 storage_params cleanup 2017-06-20 10:27:28 -04:00
arvidn ff454a92d4 unify some operation-enums and strings to use operation_t 2017-06-18 07:31:45 -04:00
arvidn b80c477733 merged RC_1_1 into master 2017-06-16 00:24:41 -04:00
arvidn a97121d6f2 move_storage did not work for torrents without metadata 2017-06-15 21:20:22 -04:00
Alden Torres 48ef3b6bf7 implemented support for BEP 51 (#1652) 2017-06-12 11:54:11 +02:00
arvidn 147d996160 make the job action enum an enum class 2017-06-11 23:53:58 +02:00
arvidn f3d319b677 fix internal use of deprecated function identify_client 2017-06-10 08:16:23 +02:00
Andrei Kurushin fc0cbfb789 fix bandwith rate limit calculation (#2060) 2017-06-08 12:50:55 +02:00
arvidn 4de9f6a75b remove requester parameter to disk read jobs 2017-06-08 12:38:25 +02:00
arvidn 6967d17a42 make move constructors and move assignment operators noexcept 2017-06-01 23:42:15 +02:00
Arvid Norberg 5344761da4 make flags to move_storage a proper enum class (#2043) 2017-06-01 04:15:15 -04:00
arvidn afce0d3a86 make resolver_flags use enum class for improved type-safety 2017-05-29 18:38:59 -04:00
arvidn ffaabd846c make file open mode flags be an enum class for type-safety 2017-05-28 11:16:59 -04:00
Arvid Norberg 660cdaf2d1 deprecate direct access to array in session_stats_alert (#2033) 2017-05-27 20:33:31 -04:00
Arvid Norberg 1925d1e7aa add test for recent duplicate add bug (#2003) 2017-05-17 23:04:50 -04:00
arvidn 73a3e390b5 merge RC_1_1 into master 2017-05-15 09:12:23 -04:00
arvidn 56d5d795bf improve path sanitization (filter unicode text direction characters) 2017-05-15 01:49:41 -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
Pavel Pimenov 0ac16532ee remove unique.count(url) (#1964) 2017-05-03 20:18:30 -04:00
arvidn af495da56b use std::function instead of the fileop interface for readwritev() 2017-05-02 08:07: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
arvidn 749d0da875 make iovec_t an alias for span<char>, in preparation for removing it altogether in favour of span 2017-04-30 11:49:08 -04:00
Steven Siloti a693565df0 hack to get test_stop_tracker_timeout working 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
arvidn 23ba9d12d1 construct and destruct objects in stack allocations (alloca()) 2017-04-28 21:34:31 -04:00
arvidn 2dca174785 improve span container constructor 2017-04-28 08:17:57 -04:00
arvidn a9a12e873f make DHT bootstrapping more robust by not throwing away nodes 2017-04-25 23:03:52 -04:00
arvidn 4eb5155263 use span<> for peer_connection::send_buffer 2017-04-25 23:02:32 -04:00
arvidn d138f02424 introduce lt namespace alias 2017-04-23 23:43:58 -04:00
Steven Siloti bcfaf9621a fixes from review 2017-04-23 19:49:49 -04:00
Steven Siloti cdd50be859 create a separate DHT node for each listen socket 2017-04-23 19:49:49 -04:00
Alden Torres 735214a806 avoid connections to trackers when the event is stopped and stop_tracker_timeout <= 0 (#1932) 2017-04-22 18:33:26 -04:00
arvidn 04c76249b6 merged RC_1_1 into master 2017-04-21 01:21:31 -04:00
arvidn 227830e757 fix memory leak in the disk cache. if a cached_piece_entry would stick around in a ghost list (ARC), it would keep the torrent object itself alive. when aborting read jobs, the outstanding_read flag need to be cleared on the piece. When reclaiming a block for a piece that should be deleted (not just evicted) it need to know that. This patch adds an additional bit to cached_piece_entry to communicate this 2017-04-19 22:30:27 -04:00
Jan Berkel cdf066c4e1 magnet links: unescape hash parameter (#1925) 2017-04-19 00:52:35 -04:00
arvidn df299fcb00 use boost::variant for disk_io_job in/out parameter, to support holding a proper disk io buffer handle and string 2017-04-17 15:08:27 -04:00
arvidn cef9773c70 generalize part_file::export_file to pass back the buffers to a callback function 2017-04-15 20:01:18 -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 c35718d322 use unsigned integer for file and storage flags (#1895)
use unsigned integer for file and storage flags
2017-04-09 01:28:46 -04:00
arvidn 51c42adc3e steps towars making file_pool private to disk_io_thread 2017-04-07 08:38:35 -04:00
Alden Torres 6888296c43 added compare_less_wrap test 2017-04-04 23:12:48 -04:00