Commit Graph

478 Commits

Author SHA1 Message Date
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
arvidn 480bde9333 change formatting of namespace declarations 2017-04-12 14:26:35 -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
Arvid Norberg 13b16a63a3 use unsigned type for file flags. make file_pool private to disk_io_thread (#1894)
use unsigned type for file flags. make file_pool private to disk_io_thread. move close_file_interval logic to the disk thread. don't expose file in public interface, and make pool_file_status properly public (not part of file_pool and renamed to open_file_status), this is exposed in public interface via torrent_handle::file_status()
2017-04-08 18:24:50 -04:00
arvidn 86f67bd9d9 return a reference instead of pointer to file_storage in storage_interface 2017-04-07 20:27:38 -04:00
arvidn 51c42adc3e steps towars making file_pool private to disk_io_thread 2017-04-07 08:38:35 -04:00
arvidn 206a80acfb optimize construction of disk io storage objects 2017-03-23 17:45:11 -04:00
arvidn 3a1379ef1e merged RC_1_1 into master 2017-03-14 12:55:13 -04:00
arvidn dec8c853e3 fix default file pool size on windows 2017-03-09 23:26:53 -05:00
arvidn 5cb12318c5 fix bug where settings_pack::file_pool_size setting was not being honored 2017-03-09 08:18:10 -05:00
Alden Torres de6f2a9d88 fixing sign-conversion warnings, part 11, created aux::array and refactor (#1649)
fixing sign-conversion warnings, part 11, created aux::array and refactor
2017-02-04 22:05:53 -05:00
Alden Torres d36c598eeb fixing sign-conversion warnings, part 10 (#1642)
fixing sign-conversion warnings, part 10
2017-01-30 20:31:32 -05:00
Arvid Norberg 29db3de6c0 wrap most instances of throw, and terminate on builds where exceptions are disabled (#1639)
wrap most instances of throw, and terminate on builds where exceptions are disabled
2017-01-29 15:37:42 -05:00
Alden Torres 2437b3c134 created aux::typed_span and related refactor 2017-01-28 23:28:38 -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
Alden Torres 070e85090b more std:: prefix, consts, auto refactor, formatting 2017-01-26 08:30:20 -05:00
arvidn d03540e3b3 move disk_job_fence to its own file 2017-01-22 01:20:27 -05:00
Alden Torres ef9d1ecd7f fixing sign-conversion warnings, part 6 2017-01-17 20:51:26 -05:00
Arvid Norberg 3d06371f31 factor out some common storage utilities out of storage.cpp (#1515)
factor out some common storage utilities out of storage.cpp
2017-01-11 00:42:10 -05:00