Commit Graph

340 Commits

Author SHA1 Message Date
arvidn aaf9304a3b update year in copyright header 2018-04-09 09:04:33 +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
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 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
Arvid Norberg f5c7a49d61 remove incorrect deleted-storages assert and add some more test coverage in test_metadata_extensions (#1286) 2016-11-03 19:39:42 -04:00
Arvid Norberg d1a59879cb deprecate mmap_cache (#1269)
deprecated mmap_cache feature
2016-10-29 13:42:42 -04:00
Steven Siloti cf7db392b6 assert that offset didn't change while hashing 2016-10-25 07:59:02 -04:00
Steven Siloti f36b9a805a avoid concurrent access to hash offset
Since partial_hash::offset is not an atomic it is technically UD to access it
concurrently from multiple threads.
2016-10-25 07:59:02 -04:00
Steven Siloti 241e9fd25a add assert to detect index out-of-range 2016-10-25 07:59:02 -04:00
Arvid Norberg 5f7e2eb928 run undefined sanitier on travis/linux (#1134)
run undefined sanitizer on travis/linux. back-port ed25519 unit test from master
2016-10-08 12:29:46 -04:00
arvidn 0095aa084f make coalesce reads and coalesce writes actually work 2016-03-20 16:34:19 -04:00
arvidn f7c9062019 deprecate more parts of explicit cache as well as fixing typos of TORRENT_NO_DEPRECATE preprocessor tests 2016-03-19 07:54:29 -04:00
arvidn 317eb2fe2a remove unused disk allocation code 2016-03-16 20:13:28 -04:00
Arvid Norberg a1d60db706 Merge pull request #547 from arvidn/no-read-cache-1.1
fix use_read_cache=false
2016-03-16 08:14:15 -04:00
arvidn 4926081960 fix use_read_cache=false 2016-03-16 02:22:18 -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
Steven Siloti 4331f57021 restrict check_cache_level to only runing on one thread at a time
If another thread trys to call check_cache_level then m_cache_check_state is set
to indicate that the thread currently in check_cache_level needs to call it again.
2016-03-14 19:03:12 -07:00
Steven Siloti d405535a3f try to free the piece after kicking the hasher and flushing 2016-03-14 19:03:12 -07:00
Steven Siloti e8f93df700 fix indentation 2016-03-14 19:03:12 -07:00
Steven Siloti 826bbe35ee always cache writes 2016-03-14 19:03:12 -07:00
Steven Siloti 6e8db41dd2 check_cache_level after performing a job rather than before
If dirty blocks are added while the job is running there is a chance of
deadlock if the dirty blocks cause the cache to exceed its size limit and
no further jobs come in to trigger another check.
2016-03-14 19:03:12 -07:00
Steven Siloti 9c5bb25d65 always clear outstanding_flush after attempting to flush a cached write
Also clear outstanding_flush before calling kick_hasher because kick_hasher
may unlock the cache mutex which can allow more dirty blocks to be added
which may require another flush_hashed job be added.
2016-03-14 19:03:12 -07:00
arvidn 921cbeebed add option to delete just the partfile when removing a torrent 2016-03-14 08:26:39 -04:00
arvidn 0d0048d415 try to evict a volatile piece before allocating a new one for a hash check. It may be faster to check files without growing the cache, or reusing the same buffers. 2016-03-13 12:52:44 -04:00
arvidn 67774d660d always keep at least 2 async hash jobs outstanding when rechecking torrents (to keep the bandwidth delay product full) 2016-03-06 16:31:18 -05:00
arvidn a02c1d2164 record cache settings in the job instead of checking it twice for more robust behavior 2016-03-06 16:15:13 -05:00
arvidn 8ca76f9d59 fix support for auto disk cache size and disk buffer pool allocator behavior 2016-03-06 16:14:55 -05:00
arvidn 2bd6ad9974 remove invalid assert in the disk thread 2016-03-04 20:20:49 -05:00
arvidn 1f9f588e75 merge copyright year update and changelog from RC_1_0 2016-01-17 18:57:46 -05:00
arvidn 4cc2e879c4 comment out verbose pex logging. fix bug in disabled_storage and an error reporting issue on short reads in default_storage 2016-01-10 11:50:56 -05:00
arvidn 2acb3dcb24 clean up use of getrlimit() by wrapping it and move it to platform_util.cpp. Also take the opportunity to make it simulator friendly (consistent in simulation) 2015-12-02 00:45:34 -05:00
arvidn b628692223 separate out announce_entry and torrent_status into their own headers 2015-09-18 08:08:08 -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 904da120d7 fixed some warnings 2015-08-20 22:28:00 +02:00
arvidn 8cf8e65861 turn linked_list into a template to improve type safety and remove some casts 2015-08-20 02:02:46 +02:00
arvidn ffa870d280 fixed some GCC warnings 2015-08-20 01:33:20 +02:00
arvidn bd177a857f make tailequeue a template, introduce type safety, remove old-style casts 2015-08-19 15:22:05 +02:00
arvidn 5c8fc818c1 fix more warnings 2015-08-19 01:39:01 +02:00
arvidn 12da02ae52 fix some warnings 2015-08-18 09:33:00 -04:00
arvidn 8d8c049d9e fix warnings and invalid defines in disk_io_thread.cpp 2015-08-18 07:55:50 -04:00
arvidn 9a0092c120 fix some warnings 2015-08-16 12:17:23 -04:00
Alden Torres cd8a4d2511 Moved TORRENT_DISK_STATS to default_storage with the option of enable/disable at runtime. 2015-08-03 18:16:43 -04:00
arvidn e0c3d28321 fix some warnings 2015-08-02 15:55:05 -04:00
arvidn 2b05b1c85c fix cppcheck warnings 2015-07-11 10:36:13 -04:00
arvidn f91799006a fix make_shared invocation 2015-06-14 16:42:52 -04:00
arvidn 5cb095f6d2 support using 0 disk threads (to perform disk I/O in network thread) 2015-06-14 16:00:04 -04:00
arvidn 389ffc622c don't pull in the asio namespace in libtorrent. refer to it by boost::asio 2015-06-06 01:24:25 -04:00
Arvid Norberg d43f7b56a2 update copyright year 2015-06-03 05:18:48 +00:00