1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-09 13:24:26 +00: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
2013-10-20 20:29:33 +03:00
2014-05-04 15:28:58 +03:00
2014-05-04 15:31:26 +03:00
2013-10-27 16:07:02 +02:00
2014-05-04 15:41:47 +03:00
2014-05-08 00:57:11 +03:00
2014-05-08 00:57:11 +03:00
2012-02-20 20:49:31 +02:00
2012-09-20 20:45:53 +03:00
2014-05-04 16:28:29 +03:00
2012-09-06 15:40:50 +03:00
2009-07-15 11:02:56 +00:00
2013-10-20 13:25:21 +03:00
2013-07-28 20:31:01 +04:00

qBittorrent - A BitTorrent client in Qt

Build Status


###Description: qBittorrent is a bittorrent client programmed in C++ / Qt that uses libtorrent (sometimes called libtorrent-rasterbar) by Arvid Norberg.

It aims to be a good alternative to all other bittorrent clients out there. qBittorrent is fast, stable and provides unicode support as well as many features.

This product includes GeoLite data created by MaxMind, available from http://maxmind.com/

Installation:

For installation, follow the instructions from INSTALL file, but simple:

./configure
make && make install
qbittorrent

will install and execute qBittorrent hopefully without any problem.

For more information please visit: http://www.qbittorrent.org

or our wiki here: http://wiki.qbittorrent.org

Please report any bug (or feature request) to: http://bugs.qbittorrent.org

You can also meet me (sledgehammer_999) on IRC: #qbittorrent on irc.freenode.net


sledgehammer999 sledgehammer999@qbittorrent.org

Description
Some work about adaptive color scheme for Web UI (PR #19901) http://[316:c51a:62a3:8b9::4]/d4708/qBittorrent/src/branch/adaptive-webui
Readme 149 MiB
Languages
C++ 71.5%
JavaScript 13.5%
HTML 12.1%
Python 1%
CSS 0.7%
Other 1.1%