mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-17 06:41:26 +00:00
only replace tracker if handle is valid
This commit is contained in:
parent
f436cbff64
commit
ac00fef1d4
@ -1779,18 +1779,17 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
torrent_handle& h = M_torrents->at(index).handle;
|
torrent_handle& h = M_torrents->at(index).handle;
|
||||||
|
if (h.is_valid()){
|
||||||
std::vector<libtorrent::announce_entry> trackerlist;
|
std::vector<libtorrent::announce_entry> trackerlist;
|
||||||
|
|
||||||
std::istringstream trackers(tracker);
|
std::istringstream trackers(tracker);
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
while (std::getline(trackers, line)) {
|
while (std::getline(trackers, line)) {
|
||||||
libtorrent::announce_entry a_entry(line);
|
libtorrent::announce_entry a_entry(line);
|
||||||
trackerlist.push_back(a_entry);
|
trackerlist.push_back(a_entry);
|
||||||
}
|
}
|
||||||
h.replace_trackers(trackerlist);
|
h.replace_trackers(trackerlist);
|
||||||
h.force_reannounce();
|
h.force_reannounce();
|
||||||
|
}
|
||||||
Py_INCREF(Py_None); return Py_None;
|
Py_INCREF(Py_None); return Py_None;
|
||||||
}
|
}
|
||||||
static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args)
|
static PyObject *torrent_prioritize_files(PyObject *self, PyObject *args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user