summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Pinto <markybob@dipconsultants.com>2007-11-25 23:59:19 +0000
committerMarcos Pinto <markybob@dipconsultants.com>2007-11-25 23:59:19 +0000
commit8dfb4b73eb74dfd7388148dd676d586aaacdcc15 (patch)
tree3fd85bae4d2016086a654394abc26a29e6f83c17
parent3ea3b6b5b0211d83ee1d1a9d5949385fe1c41c28 (diff)
downloaddeluge-8dfb4b73eb74dfd7388148dd676d586aaacdcc15.tar.gz
deluge-8dfb4b73eb74dfd7388148dd676d586aaacdcc15.tar.bz2
deluge-8dfb4b73eb74dfd7388148dd676d586aaacdcc15.zip
try to catch invalid handle in deluge_core
-rw-r--r--src/deluge_core.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp
index 829696e25..699c43dfb 100644
--- a/src/deluge_core.cpp
+++ b/src/deluge_core.cpp
@@ -1787,23 +1787,26 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args)
if (PyErr_Occurred())
return NULL;
- if (M_torrents->at(index).handle.is_valid()){
- std::vector<libtorrent::announce_entry> trackerlist;
- std::istringstream trackers(tracker);
- std::string line;
- while (std::getline(trackers, line)) {
- libtorrent::announce_entry a_entry(line);
- trackerlist.push_back(a_entry);
- }
- if (trackerlist.empty()){
- std::vector<libtorrent::announce_entry> empty;
- M_torrents->at(index).handle.replace_trackers(empty);
- }
- else{
- M_torrents->at(index).handle.replace_trackers(trackerlist);
- M_torrents->at(index).handle.force_reannounce();
+ try {
+ if (M_torrents->at(index).handle.is_valid()){
+ std::vector<libtorrent::announce_entry> trackerlist;
+ std::istringstream trackers(tracker);
+ std::string line;
+ while (std::getline(trackers, line)) {
+ libtorrent::announce_entry a_entry(line);
+ trackerlist.push_back(a_entry);
+ }
+ if (trackerlist.empty()){
+ std::vector<libtorrent::announce_entry> empty;
+ M_torrents->at(index).handle.replace_trackers(empty);
+ }
+ else{
+ M_torrents->at(index).handle.replace_trackers(trackerlist);
+ M_torrents->at(index).handle.force_reannounce();
+ }
}
- }
+ }
+ catch (libtorrent::invalid_handle&) {}
Py_INCREF(Py_None); return Py_None;
}
static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args)