Commit graph

45 commits

Author SHA1 Message Date
sledgehammer999
7419e930ab Indentation fixes. 2014-07-06 23:18:37 +03:00
sledgehammer999
9a18b50751 Some fixes for commit 6dabf50781. 2014-07-06 21:39:27 +03:00
Ivan Sorokin
6dabf50781 Speedup and fix a bug in torrent moving.
This commit implements a map where qbittorrent store a state of
current torrent movings. This commit speed up
torrents moving a bit and also fix a bug when qbittorrent doesn't do
cleanup action when a single torrent is moved several times without
waiting for a previous move to complete.

How it worked before.

Libtorrent has a function torrent_handle::move_storage() that allows to move a
torrent to a specific directory. This function is asynchorous. It means that
this function quits instantaneously and when the actual operation
completes the alert 'storage_moved_alert' or
'storage_moved_failed_alert' will be sent. The storage_moved_alert contains a
torrent_handle and a new path to where the torrent is moved.

During handling of storage_moved_alert, qbittorrent needs not only new path,
but also an old path to perform some of cleanup actions (like removing an old
folder if it is empty). This was achieved by storing a value named
'previous save path' in TorrentPersistentData. A previous save path is
written when move_storage() is issued and is read when
storage_moved_alert is received.

Problems.

This mechanism has two negative aspects:

1. TorrentPersistentData is very slow. As torrent_handle::move_storage() is asynchoronous,
TorrentPersistentData is responsible for more that 99.8% of time
QTorrentHandle::move_storage(). This percent could be higher when there
are lots of torrents and lower when there are few of them.

2. TorrentPersistentData stores only one previous path. But many
move_storage()'s could be issued without waiting for previous to
complete. Subsequent move_storage()'s overwrites previous save path of a
previous move.

A fix.

The fix is simple. Before issueing move_storage() the oldPath is stored in
a special map called 'torrentMoveStates'. When a storage_moved_alert
is received the map is consulted and an alert is handled.

When user moves torrent when previous moving have not yet finished, the
new location is saved in a field 'queuedPath' the same map. When
torrent moving is completed (or failed) qbittorrent attemps to perform
move again to the queued location.

Future direction.

This fix removes one slow read and one slow write to
TorrentPersistentData on torrent moving, but there is still exists
TorrentPersistentData::saveSavePath in handleStorageMovedAlert(), so
overall time for UI hang should be reduced only threefold. A speeding up
TorrentPersistentData should be addressed in a separate commit.

I don't know if I should clean up torrentMoveStates when torrent is
deleted. In any case, torrent could be deleted when corresponding alert
is in alert queue. So if we decide to clean up torrentMoveStates, then
we should not treat receiving alert from unknown torrent as a error.
2014-06-23 11:21:24 +04:00
sledgehammer999
d58d87a691 Use completed time from libtorrent directly. Closes #1726. 2014-06-07 14:44:08 +03:00
Nick Tiskov
32b90a7b6d Update QTorrentHandle
Guaranteed to accept strings with both native and qt-style separators; guaranteed to use native separators with libtorrent API
2014-01-22 19:37:26 +04:00
sledgehammer999
e08ae6b668 Fix magnet metadata loading. Update the queue and save_path correctly in all use cases. 2013-10-09 23:34:00 +03:00
sledgehammer999
14310f9b05 Improve loading of magnet metadata in the background.
Conflicts:
	src/qtlibtorrent/qbtsession.cpp
2013-10-06 13:49:23 +03:00
sledgehammer999
bbf47b0907 Optimize torrentperistentdata parameters and add utility funtions for previous commit. 2013-10-01 01:57:35 +03:00
sledgehammer999
7aa3eff845 Add constness and value by reference in TorrentTempData. 2013-05-04 21:29:18 +03:00
sledgehammer999
9a0a26dae1 Store TorrentTempData only in memory. Partially implements #583. 2013-05-04 17:56:26 +03:00
BotanEgg
bb11d11a72 Itr cache 2012-07-14 06:28:23 +08:00
Константин Гончарик
abf8c179fc Use preincrement for iterators instead of postincrement 2012-07-13 21:48:19 +03:00
Christophe Dumez
c502edf9e1 Brand new torrent addition dialog 2012-05-15 19:57:31 +03:00
Christophe Dumez
f3448125c3 Coding style clean up 2012-02-20 19:56:07 +02:00
Christophe Dumez
a8a7b61ea9 Coding style clean up 2012-02-20 19:30:53 +02:00
Christophe Dumez
a53a70742d Drop support for libtorrent v0.14.x 2012-02-18 16:44:20 +02:00
Christophe Dumez
82e41f36ee FEATURE: Added per-torrent ratio limiting (Christian Kandeler) 2011-03-07 19:26:44 +00:00
Christophe Dumez
b7ec18e4f1 Do not create the torrent root folder at the destination if the torrent is in temp dir 2010-11-10 17:42:20 +00:00
Christophe Dumez
658d876ff7 Fix and improve file priorities editing 2010-10-31 16:05:59 +00:00
Christophe Dumez
90dd337069 FEATURE: Added a torrent import assistant to seed or keep downloading outside torrents 2010-10-23 16:21:56 +00:00
Christophe Dumez
f617b74bac Performance optimization and code clean up 2010-10-19 20:00:50 +00:00
Christophe Dumez
290932e128 Big code clean up 2010-10-17 14:46:01 +00:00
Christophe Dumez
a27d2dcac2 Big restructuring of the RSS code
Dropped Qt 4.4 support
2010-10-16 17:39:03 +00:00
Christophe Dumez
c9c2ab320d Remember completion date correctly 2010-10-02 12:52:06 +00:00
Christophe Dumez
aa58636832 When resuming a torrent with error, checking if the previous data is present before redownloading it. (closes #609748) 2010-07-25 14:55:30 +00:00
Christophe Dumez
51068294f1 Vavious Magnet link related fixes 2010-07-19 18:17:37 +00:00
Christophe Dumez
8f5bd2bc9f Fix other temp path issues 2010-07-17 21:35:00 +00:00
Christophe Dumez
121a636b4e Fix several problems when incomplete torrent are kept in a temp folder
Bump to rc3
2010-07-16 19:53:47 +00:00
Christophe Dumez
b9241ad5ad Proper fix to use an INI file instead of the registry on Windows 2010-07-16 15:03:18 +00:00
Christophe Dumez
5f23cbc470 Use libtorrent version.hpp instead of our own DEFINE 2010-06-07 08:32:41 +00:00
Christophe Dumez
8ec1621334 Merge msvc fixes from stable branch 2010-06-05 18:59:05 +00:00
Christophe Dumez
789cf654d0 Another attempt to fixing Mac compilation 2010-03-20 19:09:27 +00:00
Christophe Dumez
aec99ed14f More code cleanup 2010-03-04 20:19:25 +00:00
Christophe Dumez
e082c02630 Make use of QT_VERSION define instead of using our own define 2010-03-04 18:40:11 +00:00
Christophe Dumez
fb79146ae6 FEATURE: Added "Added/Completed On" columns to transfer list 2010-01-30 16:28:07 +00:00
Christophe Dumez
cac6f7428c - When incomplete torrents are saved to a different path, check if content is already present at final location
- Automacillay force a data recheck every time a torrent is moved (because libtorrent does not take care of checking if the torrent data exists at the destination location)
2010-01-04 21:16:33 +00:00
Christophe Dumez
7bac95c9ad - Torrents can be renamed in transfer list 2010-01-01 13:25:59 +00:00
Christophe Dumez
add2475700 - Files / Folders can also be renamed directly from torrent addition dialog 2010-01-01 10:55:13 +00:00
Christophe Dumez
04e008afa0 - Fix new settings not being saved 2009-12-18 16:32:26 +00:00
Christophe Dumez
ed803fb994 - Initiated work on torrent labeling/categorization (functional but not perfect yet 2009-12-15 19:52:43 +00:00
Christophe Dumez
abbbf1e562 - Torrent Addition Dialog: File priorities were not taken into consideration (Thanks Mariusz) 2009-12-08 17:20:28 +00:00
Christophe Dumez
9323660c79 - Fix compilation with Qt 4.4
- Fix compilation with older boost libraries
2009-11-28 21:46:46 +00:00
Christophe Dumez
d42ab6120e - Added right-click menu to transfer list 2009-11-24 19:41:31 +00:00
Christophe Dumez
aa0c2e611f - Remove useless code in torrentpersistentdata since libtorrent is saving and restoring this for us 2009-11-20 18:29:13 +00:00
Christophe Dumez
262b88930e - Use lowercase characters only in filenames 2009-11-20 07:48:44 +00:00
Renamed from src/torrentPersistentData.h (Browse further)