Commit graph

340 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
1c98c11dd0 speed up icon loading 2014-05-25 12:32:09 +04:00
Ivan Sorokin
bbc4080a5d fewer calls to hash() 2014-05-25 12:32:09 +04:00
sledgehammer999
5d2663660d Count magnet links in the 'downloading' filter and make them prevent system inhibition. Closes #1558 2014-05-15 22:01:27 +03: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
sledgehammer999
ef3f7d18c9 Fix compilation with Qt5. 2014-05-04 15:28:54 +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
sledgehammer999
79b3e5ab60 Merge pull request #1324 from Gelmir/rename_amount_columns
Use shorter names for amount columns in main UI
2014-01-25 15:48:40 -08:00
Nick Tiskov
1dd8fa3c58 Use shorter names for amount columns in main UI 2014-01-25 23:28:34 +04:00
sledgehammer999
8bbdcc78ce Statistics: handle case where user has gone back to older version. 2014-01-25 21:03:23 +02:00
Nick Tiskov
4390530cbe Update Main UI 2014-01-22 19:37:31 +04: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
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
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
bb7c2dd9c6 Improvements on statistics saving. 2014-01-21 17:40:30 +02:00
sledgehammer999
0d139234fe Fix condition checking in statistics saving. 2014-01-21 16:57:20 +02:00
sledgehammer999
4d3672f894 Save statistics every 15min and only if there was new traffic. Fixes #1288 and partially #1272. 2014-01-21 02:12:27 +02: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
Konstantin Goncharik
bc22447a6a In qtorrenthandle.cpp exception made caught by reference 2014-01-04 01:19:30 +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
Nick Tiskov
b4e9a9bbc0 1. Use a better icon for stats dialog.
2. Use more reliable session_status.total_download/upload for statistics
2013-12-23 00:01:21 +04: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
f09328c13c Fix inhibit system functionality. Closes #766. 2013-11-16 19:29:50 +02:00
sledgehammer999
51a9a9aabb Make all columns and headers use the same text alignment in the transferlist. 2013-11-09 19:39:13 +02: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
8f955fe110 Distinguish more torrent states. 2013-10-22 21:34:27 +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
sledgehammer999
d0893bc1c7 Allow the scheduler to have a start time that's after the end time. Closes #980. 2013-10-20 13:46:55 +03:00
sledgehammer999
c9a8430463 Make the scheduler timeout every 1.5s. 2013-10-20 13:28:35 +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
Nick Tiskov
382155bc26 Prepare bandwidth scheduler code 2013-10-19 21:35:26 +04:00