Commit Graph

496 Commits

Author SHA1 Message Date
Alden Torres a357e490ed minor code refactor, more use of auto 2018-06-08 21:56:06 +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
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 299a545648 add test for suggests- and seed mode combined 2018-05-10 17:40:23 +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
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
Xiyue Deng 21d8e9e26b Add missing header <cstdarg> for va_list.
* Fix building on OpenBSD.
2018-04-24 23:09:25 -04:00
Arvid Norberg d8c022070f merged RC_1_1 into master 2018-04-21 17:17:55 -04:00
arvidn f0227451a6 merged RC_1_1 into master 2018-04-13 01:47:41 +02:00
arvidn aaf9304a3b update year in copyright header 2018-04-09 09:04:33 +02:00
Alden Torres d6edf26e11 minor code tidy 2018-04-07 00:30:36 +02:00
gubatron 2a82bb5880 disk_io_thread abort_hash_jobs duplicate code refactor 2018-04-05 16:01:30 +02:00
arvidn 9df4d4b7f8 replace typedef with using. replace NULL with nullptr. cleanup page_aligned_allocator 2018-03-23 11:19:46 +01:00
arvidn a0a63341c7 fix haiku build 2018-02-04 19:10:43 +01: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 0731200149 block_size is a constant, no need in passing it around as a variable 2018-01-03 08:45:25 -05:00
arvidn c3bdc6f825 use an intrusive linked list for peer_cache_entry instead an unordered set, to avoid heap allocations and make cache operations not able to fail. This simplifies error handling 2017-12-28 00:52:09 +01:00
Alden Torres c97bd53cde more use of const, emplace_back and minor code refactor 2017-11-20 23:45:41 +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 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
arvidn 98effc8d88 minor disk_io_job piece_hash cleanup 2017-10-22 16:49:25 +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 68f05d6380 fix some warnings and integer overflow with torrents that are too big 2017-09-28 14:59:28 -07:00
arvidn c66f4cc62a fix some warnings, mostly 0 -> nullptr 2017-09-28 07:33:10 -07:00
arvidn 93bb84d94c some random cleanup 2017-09-13 08:28:46 +02:00
arvidn 55228756e5 make disk job flags type safe 2017-09-10 08:56:52 +02:00
arvidn fe1c395579 merged RC_1_1 into master 2017-09-03 13:57:19 +02:00
Steven Siloti 621da10e60 hold an owning reference to storage objects in try_flush_write_blocks
It is possible for all other references to a storage object to be
destroyed while try_flush_write_blocks is running. If the storage is
destroyed then find_piece will crash when trying to re-aquire the
shared_ptr. To prevent this, keep the storage alive by holding a
shared_ptr to it in try_flush_write_blocks.

Normally the fence job when stopping a torrent would prevent the storage
object from being destroyed until all flush jobs are complete.
try_flush_write_blocks can be run after every disk job though so it has
the potential to "stradle the fence".

If the associated torrent does get unloaded then it is expected that
find_piece will return NULL thus causing the entry to be ignored.
2017-08-30 12:45:06 +02:00
Steven Siloti 2365611507 remove support for using a pool allocator for disk buffers (#2257) 2017-08-19 11:04:39 +02:00
arvidn 322007bb6a make save_state_flags a strong type 2017-07-30 09:06:41 -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
Alden Torres 10bfe18ebe added consts and minor code formatting 2017-07-03 16:58:49 -04:00
arvidn ff454a92d4 unify some operation-enums and strings to use operation_t 2017-06-18 07:31:45 -04:00
arvidn 3215deb2c5 make io_service::work accounting more accurate in asio-debugging=on 2017-06-14 07:01:06 -04:00
arvidn 147d996160 make the job action enum an enum class 2017-06-11 23:53:58 +02:00
arvidn 4de9f6a75b remove requester parameter to disk read jobs 2017-06-08 12:38:25 +02:00
Arvid Norberg 5344761da4 make flags to move_storage a proper enum class (#2043) 2017-06-01 04:15:15 -04:00
arvidn ffaabd846c make file open mode flags be an enum class for type-safety 2017-05-28 11:16:59 -04:00
arvidn 392f284566 remove some unused stats gathering state in disk_io_thread 2017-05-23 08:16:25 -04:00
arvidn e79a7a08b9 fix race condition in storage tick handling in disk_io_thread 2017-05-18 10:21:34 -04:00
arvidn af495da56b use std::function instead of the fileop interface for readwritev() 2017-05-02 08:07:29 -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
arvidn b553cb32f7 fix storage destruction order issue 2017-04-22 17:30:31 -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
arvidn 2d6268b580 fix double free in disk cache 2017-04-17 19:54:05 -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