1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

- Catch invalid_handle exception in savefastresume data

This commit is contained in:
Christophe Dumez 2009-11-28 13:50:16 +00:00
parent 08fe5814c5
commit 27aff04f11
2 changed files with 10 additions and 7 deletions

View File

@ -1124,8 +1124,10 @@ void Bittorrent::saveFastResumeData() {
if (rda) { if (rda) {
--num_resume_data; --num_resume_data;
s->pop_alert(); s->pop_alert();
// Remove torrent from session try {
s->remove_torrent(rda->handle); // Remove torrent from session
s->remove_torrent(rda->handle);
}catch(libtorrent::libtorrent_exception){}
continue; continue;
} }
save_resume_data_alert const* rd = dynamic_cast<save_resume_data_alert const*>(a); save_resume_data_alert const* rd = dynamic_cast<save_resume_data_alert const*>(a);
@ -1161,14 +1163,14 @@ QStringList Bittorrent::getPeerBanMessages() const {
void Bittorrent::addConsoleMessage(QString msg, QColor color) { void Bittorrent::addConsoleMessage(QString msg, QColor color) {
if(consoleMessages.size() > 100) { if(consoleMessages.size() > 100) {
consoleMessages.removeFirst(); consoleMessages.removeFirst();
} }
consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>")); consoleMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - <font color='") + color.name() +QString::fromUtf8("'><i>") + msg + QString::fromUtf8("</i></font>"));
} }
void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) {
if(peerBanMessages.size() > 100) { if(peerBanMessages.size() > 100) {
peerBanMessages.removeFirst(); peerBanMessages.removeFirst();
} }
if(from_ipfilter) if(from_ipfilter)
peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was blocked due to your IP filter</i>", "x.y.z.w was blocked").arg(ip)); peerBanMessages.append(QString::fromUtf8("<font color='grey'>")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8("</font> - ")+tr("<font color='red'>%1</font> <i>was blocked due to your IP filter</i>", "x.y.z.w was blocked").arg(ip));
@ -1515,7 +1517,7 @@ void Bittorrent::readAlerts() {
QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>()); QHash<QString, TrackerInfos> trackers_data = trackersInfos.value(h.hash(), QHash<QString, TrackerInfos>());
TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url)); TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url));
data.last_message = misc::toQString(p->msg); data.last_message = misc::toQString(p->msg);
#ifndef LIBTORRENT_0_15 #ifndef LIBTORRENT_0_15
data.verified = false; data.verified = false;
++data.fail_count; ++data.fail_count;
#endif #endif

View File

@ -56,9 +56,10 @@ public:
~ReverseResolutionST() { ~ReverseResolutionST() {
stopped = true; stopped = true;
if(isRunning()) if(isRunning()) {
resolver.cancel(); resolver.cancel();
wait(); wait();
}
} }
void setIP(boost::asio::ip::tcp::endpoint &_ip) { void setIP(boost::asio::ip::tcp::endpoint &_ip) {