From 27aff04f11ea5195cd493fbc2ce1e628f3fd56f9 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 28 Nov 2009 13:50:16 +0000 Subject: [PATCH] - Catch invalid_handle exception in savefastresume data --- src/bittorrent.cpp | 12 +++++++----- src/reverseresolution.h | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 1b14f5022..33b5010e8 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -1124,8 +1124,10 @@ void Bittorrent::saveFastResumeData() { if (rda) { --num_resume_data; s->pop_alert(); - // Remove torrent from session - s->remove_torrent(rda->handle); + try { + // Remove torrent from session + s->remove_torrent(rda->handle); + }catch(libtorrent::libtorrent_exception){} continue; } save_resume_data_alert const* rd = dynamic_cast(a); @@ -1161,14 +1163,14 @@ QStringList Bittorrent::getPeerBanMessages() const { void Bittorrent::addConsoleMessage(QString msg, QColor color) { if(consoleMessages.size() > 100) { - consoleMessages.removeFirst(); + consoleMessages.removeFirst(); } consoleMessages.append(QString::fromUtf8("")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8(" - ") + msg + QString::fromUtf8("")); } void Bittorrent::addPeerBanMessage(QString ip, bool from_ipfilter) { if(peerBanMessages.size() > 100) { - peerBanMessages.removeFirst(); + peerBanMessages.removeFirst(); } if(from_ipfilter) peerBanMessages.append(QString::fromUtf8("")+ QDateTime::currentDateTime().toString(QString::fromUtf8("dd/MM/yyyy hh:mm:ss")) + QString::fromUtf8(" - ")+tr("%1 was blocked due to your IP filter", "x.y.z.w was blocked").arg(ip)); @@ -1515,7 +1517,7 @@ void Bittorrent::readAlerts() { QHash trackers_data = trackersInfos.value(h.hash(), QHash()); TrackerInfos data = trackers_data.value(tracker_url, TrackerInfos(tracker_url)); data.last_message = misc::toQString(p->msg); - #ifndef LIBTORRENT_0_15 +#ifndef LIBTORRENT_0_15 data.verified = false; ++data.fail_count; #endif diff --git a/src/reverseresolution.h b/src/reverseresolution.h index 5ee5b4273..cb8ac1011 100644 --- a/src/reverseresolution.h +++ b/src/reverseresolution.h @@ -56,9 +56,10 @@ public: ~ReverseResolutionST() { stopped = true; - if(isRunning()) + if(isRunning()) { resolver.cancel(); - wait(); + wait(); + } } void setIP(boost::asio::ip::tcp::endpoint &_ip) {