summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Pinto <markybob@dipconsultants.com>2007-11-26 02:20:40 +0000
committerMarcos Pinto <markybob@dipconsultants.com>2007-11-26 02:20:40 +0000
commit4c2388499baff354344d8161df3d87d292883e4a (patch)
tree5a89db95fa671766d4d5be23109a7861921a3fcc
parent804b534009933ece3b3c1697d10daa0cff5eba72 (diff)
downloaddeluge-4c2388499baff354344d8161df3d87d292883e4a.tar.gz
deluge-4c2388499baff354344d8161df3d87d292883e4a.tar.bz2
deluge-4c2388499baff354344d8161df3d87d292883e4a.zip
tweak last
-rw-r--r--src/deluge_core.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp
index 5f90e705f..06f2f45cd 100644
--- a/src/deluge_core.cpp
+++ b/src/deluge_core.cpp
@@ -252,19 +252,27 @@ boost::filesystem::path const& save_path)
} else {
storage_mode = storage_mode_sparse;
}
- torrent_handle h = M_ses->add_torrent(t, save_path, resume_data, storage_mode);
- // h.set_max_connections(60); // at some point we should use this
- h.set_max_uploads(-1);
- h.set_ratio(preferred_ratio);
- h.resolve_countries(true);
- new_torrent.handle = h;
-
- new_torrent.unique_ID = M_unique_counter;
- M_unique_counter++;
-
- M_torrents->push_back(new_torrent);
-
- return (new_torrent.unique_ID);
+ try{
+ torrent_handle h = M_ses->add_torrent(t, save_path, resume_data, storage_mode);
+ // h.set_max_connections(60); // at some point we should use this
+ h.set_max_uploads(-1);
+ h.set_ratio(preferred_ratio);
+ h.resolve_countries(true);
+ new_torrent.handle = h;
+ new_torrent.unique_ID = M_unique_counter;
+ M_unique_counter++;
+ M_torrents->push_back(new_torrent);
+ return (new_torrent.unique_ID);
+ }
+ catch (invalid_encoding&)
+ {
+ printf("invalid encoding...bad torrent\n");
+ }
+ catch (invalid_handle&)
+ {
+ printf("invalid handle. something bad happened in libtorrent\n");
+ }
+ catch (...) {}
}
@@ -1809,6 +1817,10 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args)
}
}
}
+ catch (invalid_handle&)
+ {
+ printf("invalid handle. something bad happened in libtorrent\n");
+ }
catch (...) {}
Py_INCREF(Py_None); return Py_None;
}