Commit graph

250 commits

Author SHA1 Message Date
Ivan Sorokin
6f38616193 extract torrent statistics from torrent speed monitor to separate file 2014-06-02 00:31:45 +04:00
Ivan Sorokin
b50d7331c7 use post_status_update()
Conflicts:
	src/qtlibtorrent/qbtsession.cpp
2014-06-02 00:31:45 +04:00
Ivan Sorokin
eb46326d23 use set_alert_dispatch instead of timer to get an alerts from libtorrent
libtorrent allows setting a custom dispatch handler that is invoked in
libtorrent thread when new alerts are incoming. QAlertDispatcher is a
class that allows to translate these alerts to UI thread.

The concept is very simple:

1. On initialization QAlertDispatcher constructor calls set_alert_dispatch() passing
 QAlertDispatcher::dispatch as argument.

2. On deinitialization destructor calls set_alert_dispatch() passing a empty
 function. (line 25) libtorrent handles thos and switches back to queuing
 alerts in queue.

3. QAlertDispatcher::dispatch() adds alert to queue and notifies UI thread that new
 alerts are incoming. Enqueuing is done in function enqueueToMainThread().
 The invariant of class is the following:

    if alert queue is not empty, in message loop of UI thread contains a queued
    invocation of deliverSignal().

4. When message loop is pumped UI thread execute deliverSignal() function.
 It emit appropriate signal and if queue is still not empty (for example
 if slot doesn't grab alerts) rewind enqueuing to main thread.

This is a idea. But here is some details.

1. When QAlertDispatcher is destoyed, libtorrent still can call
QAlertDispatcher::dispatch a few times after destruction. This is
handled by passing a "tag". A tag is a object that references QAlertDispatch.
Tag could be invalidated. So on destruction QAlertDispatcher invalidates a tag
and then unsubscribes from alerts. When QAlertDispatcher::dispatch is called
with invalid tag it simply discard an alert.

    Therefore we could drop a few alerts during unsubscription. So we unsubscribe
    only at exit when missing some alerts is not a problem.

2. Another problem is in QBtSession::saveFastResumeData(). It pumps alert
queue synchronously. My first attempt was to destroy QAlertDispatcher
and then pump libtorrent queue. But as I was afraid of losing alerts I
supported synchronous querying of alerts in QAlertDispatcher.
(QAlertDispatcher::getPendingAlerts)

Conflicts:
	src/qtlibtorrent/qbtsession.cpp
2014-06-02 00:31:45 +04:00
Ivan Sorokin
329b754197 cache torrent_status 2014-06-02 00:31:42 +04:00
Ivan Sorokin
bbc4080a5d fewer calls to hash() 2014-05-25 12:32:09 +04:00
sledgehammer999
659e0b7fef Fix tracker announcing problem(hit-and-run) when many torrents are being active. Closes #1571 2014-05-15 21:37:31 +03:00
sledgehammer999
9714b2ede9 Fix weird ratio values when torrent was imported or downloaded history was lost due to crash. 2014-05-05 21:30:15 +03:00
Vladimir Golovnev (Glassez)
ce3aac5f9d Fix functions and macros using to support both Qt4 and Qt5. 2014-05-02 00:00:03 +03:00
sledgehammer999
77329a2609 Launch external programs async and don't block. Closes #1252. 2014-01-26 14:28:58 +02:00
Nick Tiskov
237420546b Update QBtSession
Guaranteed to accept strings with native and qt-style separators; guaranteed to use qt-style separators internally, guaranteed to call libtorrent API with native separators
2014-01-22 19:37:27 +04:00
Nick Tiskov
1334386a1b Rework fsutils class to only use Qt-style separators
fsutils methods are guaranteed to accept strings with both native and qt-style separators and return strings with qt-style separators where appropriate
2014-01-22 19:37:24 +04:00
sledgehammer999
ceba1dc734 Don't count paused torrents for the autoshutdown. Closes #1280. 2014-01-16 16:17:10 +02:00
Nick Tiskov
d9ee9c7b0f Show actual protocol for listen_succeeded_alert and listen_failed_alert log messages.
Delete protocol mentioning from setListeningPort
2014-01-08 14:06:26 +04:00
Konstantin Goncharik
a2b3ad7958 In qbtsession.cpp exception made caught by reference 2014-01-04 01:24:32 +08:00
sledgehammer999
423d60cced Delete temporary after they aren't needed. Closes #1188. 2014-01-02 22:43:17 +02:00
arvidn
c1c824bcf7 don't use deprecated libtorrent functions 2014-01-01 10:04:22 -08:00
arvidn
3b4f9d2eeb fix libtorrent 1.0 compatibility 2013-12-31 17:00:14 -08:00
sledgehammer999
b0e8c1139f Merge pull request #1109 from doadin/patch-1
Fix Typo
2013-11-23 05:07:29 -08:00
sledgehammer999
e637ff188c Output a more generic message when blocking IPs and don't use italics in the log. 2013-11-23 13:30:50 +02:00
sledgehammer999
475aa6aad8 Merge pull request #1105 from Gelmir/stats
Add statistics dialog
2013-11-21 06:38:07 -08:00
sledgehammer999
8d04b04aae Revert "Don't prefer TCP connections over uTP."
This reverts commit a052963775.
2013-11-20 00:30:00 +02:00
doadin
f7dc57ee97 Fix Typo 2013-11-18 16:38:43 -05:00
Nick Tiskov
687e7a1343 Collect and save alltime UL/DL samples 2013-11-17 02:05:44 +04:00
sledgehammer999
0da5c8be3a Fix typo again. 2013-10-24 01:57:57 +03:00
sledgehammer999
27d72bd9bf Fix 'append label to save path' with magnet links. 2013-10-23 23:58:42 +03:00
sledgehammer999
b4dca951b2 Drop libtorrent 0.15.x support. 2013-10-23 22:19:58 +03:00
sledgehammer999
585954c988 Fix typo. 2013-10-23 22:19:55 +03:00
sledgehammer999
1c128c65f0 Don't use deprecated function when adding magnets. 2013-10-22 22:29:25 +03:00
sledgehammer999
e50d5611f8 Merge pull request #1007 from Gelmir/fix_showrss
Fix RSS items not being marked read when the item is a magnet link.
2013-10-20 08:22:00 -07:00
sledgehammer999
18b9de831f Turn off the scheduler when the user manually changes the rate limits mode. 2013-10-20 14:18:47 +03:00
Nick Tiskov
1341b7ea78 Fix RSS items not being marked read when the item is a magnet link. 2013-10-20 00:59:36 +04:00
sledgehammer999
ff789fc493 Show external IP in the log. Closes #968. 2013-10-13 23:19:15 +03: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
1e802f2090 Really fix compilation with 0.15.x. 2013-10-01 22:57:51 +03:00
sledgehammer999
c311080d8d Fix compilation with libtorrent 0.15.x. 2013-10-01 18:52:25 +03:00
sledgehammer999
6a45e9dbd7 Don't save resume data when torrent has an error. Prevents removing possibly useful .fastresume file and writing garbage. 2013-10-01 01:57:35 +03:00
sledgehammer999
a1a5fb065e Backup/recover torrent persistent data into each individual .fastresume file. This should mitigate the problem of users losing their torrents' settings/savepath/label after qbt wasn't shutdown cleanly. 2013-10-01 01:57:34 +03:00
sledgehammer999
4ac19e2b27 Fix encoding and don't let the OS automatically choose a port. 2013-09-20 21:23:26 +03:00
sledgehammer999
08138307da Refactor code for reporting listen failure/success. 2013-09-19 23:43:21 +03:00
sledgehammer999
da561ccd38 Fix gcc warning [-Wreorder]. 2013-09-14 16:11:04 +03:00
sledgehammer999
a052963775 Don't prefer TCP connections over uTP. 2013-08-03 15:22:20 +03:00
Nick Tiskov
ed0acede20 Use Unicode for libtorrent alert messages. 2013-07-28 17:09:07 +04:00
sledgehammer999
6c89df7206 Remove unnecessary code from qbtsession. 2013-07-27 18:07:57 +03:00
sledgehammer999
798bd2388b Allow more fine tuning of uploads. Closes #684. 2013-07-22 01:41:01 +03:00
Nick Tiskov
b6c59fd70b Do not mark articles read if download has failed
This change includes: always try to download unread articles matching ruleset already present in list (aka redownload failed items)
2013-07-18 00:21:20 +04:00
sledgehammer999
1e6aa54f0e Use default choking algorithm. fastest_upload is too biased towards fast peers. 2013-07-02 20:45:59 +03:00
Nick Tiskov
6b660d505c Allow control of cache expiry interval (libtorrent 0.16.10 allocator can now return cache to kernel) 2013-07-01 12:58:20 +04:00
sledgehammer999
be5a1ae272 Seed rand only at one place. 2013-06-30 15:32:45 +03:00
tungnian lee
9913484f68 new fix for selecting random port when system starts up 2013-06-30 15:15:44 +03:00