Browse Source

Save "resume data" once file priority is changed

adaptive-webui-19844
Vladimir Golovnev (Glassez) 4 years ago committed by Vladimir Golovnev (glassez)
parent
commit
cd6959b712
No known key found for this signature in database
GPG Key ID: 52A2C7DEE2DFA6F7
  1. 3
      src/base/bittorrent/session.cpp
  2. 13
      src/base/bittorrent/torrentimpl.cpp
  3. 14
      src/base/bittorrent/torrentimpl.h

3
src/base/bittorrent/session.cpp

@ -4257,6 +4257,9 @@ void Session::handleAlert(const lt::alert *a)
{ {
switch (a->type()) switch (a->type())
{ {
#if (LIBTORRENT_VERSION_NUM >= 20003)
case lt::file_prio_alert::alert_type:
#endif
case lt::file_renamed_alert::alert_type: case lt::file_renamed_alert::alert_type:
case lt::file_completed_alert::alert_type: case lt::file_completed_alert::alert_type:
case lt::torrent_finished_alert::alert_type: case lt::torrent_finished_alert::alert_type:

13
src/base/bittorrent/torrentimpl.cpp

@ -1876,6 +1876,14 @@ void TorrentImpl::handleFileCompletedAlert(const lt::file_completed_alert *p)
} }
} }
#if (LIBTORRENT_VERSION_NUM >= 20003)
void TorrentImpl::handleFilePrioAlert(const lt::file_prio_alert *p)
{
if (m_nativeHandle.need_save_resume_data())
m_session->handleTorrentNeedSaveResumeData(this);
}
#endif
void TorrentImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert *p) void TorrentImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert *p)
{ {
Q_UNUSED(p); Q_UNUSED(p);
@ -1913,6 +1921,11 @@ void TorrentImpl::handleAlert(const lt::alert *a)
{ {
switch (a->type()) switch (a->type())
{ {
#if (LIBTORRENT_VERSION_NUM >= 20003)
case lt::file_prio_alert::alert_type:
handleFilePrioAlert(static_cast<const lt::file_prio_alert*>(a));
break;
#endif
case lt::file_renamed_alert::alert_type: case lt::file_renamed_alert::alert_type:
handleFileRenamedAlert(static_cast<const lt::file_renamed_alert*>(a)); handleFileRenamedAlert(static_cast<const lt::file_renamed_alert*>(a));
break; break;

14
src/base/bittorrent/torrentimpl.h

@ -49,6 +49,17 @@
#include "torrent.h" #include "torrent.h"
#include "torrentinfo.h" #include "torrentinfo.h"
#if (LIBTORRENT_VERSION_NUM == 20003)
// file_prio_alert is missing to be forward declared in "libtorrent/fwd.hpp"
namespace libtorrent
{
inline namespace v2
{
struct file_prio_alert;
}
}
#endif
namespace BitTorrent namespace BitTorrent
{ {
class Session; class Session;
@ -244,6 +255,9 @@ namespace BitTorrent
void handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p); void handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p);
void handleFileCompletedAlert(const lt::file_completed_alert *p); void handleFileCompletedAlert(const lt::file_completed_alert *p);
#if (LIBTORRENT_VERSION_NUM >= 20003)
void handleFilePrioAlert(const lt::file_prio_alert *p);
#endif
void handleFileRenamedAlert(const lt::file_renamed_alert *p); void handleFileRenamedAlert(const lt::file_renamed_alert *p);
void handleFileRenameFailedAlert(const lt::file_rename_failed_alert *p); void handleFileRenameFailedAlert(const lt::file_rename_failed_alert *p);
void handleMetadataReceivedAlert(const lt::metadata_received_alert *p); void handleMetadataReceivedAlert(const lt::metadata_received_alert *p);

Loading…
Cancel
Save