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
commit32fc9bbf075005980b17a1fc88b8b692c3545467 (patch)
tree66123d507155965c5cd49a59c70a558e24d3482c
parentb7983a5ab4c2fb2ed9301cb3f12f6a93140e1d1f (diff)
downloaddeluge-32fc9bbf075005980b17a1fc88b8b692c3545467.tar.gz
deluge-32fc9bbf075005980b17a1fc88b8b692c3545467.tar.bz2
deluge-32fc9bbf075005980b17a1fc88b8b692c3545467.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;
}