try to fix persistent.state pooping

This commit is contained in:
Marcos Pinto 2007-10-28 02:00:47 +00:00
parent cd2f45da92
commit 925416dded
2 changed files with 11 additions and 6 deletions

View File

@ -1778,8 +1778,7 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args)
if (PyErr_Occurred()) if (PyErr_Occurred())
return NULL; return NULL;
torrent_handle& h = M_torrents->at(index).handle; if (M_torrents->at(index).handle.is_valid()){
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;
@ -1787,8 +1786,8 @@ static PyObject *torrent_replace_trackers(PyObject *self, PyObject *args)
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); M_torrents->at(index).handle.replace_trackers(trackerlist);
h.force_reannounce(); M_torrents->at(index).handle.force_reannounce();
} }
Py_INCREF(Py_None); return Py_None; Py_INCREF(Py_None); return Py_None;
} }

View File

@ -947,11 +947,17 @@ window, please enter your password"))
unique_id = self.manager.get_torrent_unique_id(torrent) unique_id = self.manager.get_torrent_unique_id(torrent)
try: try:
if self.manager.unique_IDs[unique_id].trackers: if self.manager.unique_IDs[unique_id].trackers:
self.manager.replace_trackers(unique_id, \ try:
self.manager.replace_trackers(unique_id, \
self.manager.unique_IDs[unique_id].trackers) self.manager.unique_IDs[unique_id].trackers)
except:
pass
if self.manager.unique_IDs[unique_id].uploaded_memory: if self.manager.unique_IDs[unique_id].uploaded_memory:
self.manager.unique_IDs[unique_id].initial_uploaded_memory \ try:
self.manager.unique_IDs[unique_id].initial_uploaded_memory \
= self.manager.unique_IDs[unique_id].uploaded_memory = self.manager.unique_IDs[unique_id].uploaded_memory
except:
pass
except AttributeError: except AttributeError:
pass pass