Changeset 2317

Show
Ignore:
Timestamp:
11/25/07 23:59:19 (14 months ago)
Author:
markybob
Message:

try to catch invalid handle in deluge_core

Files:
2 modified

Legend:

Unmodified
Added
Removed
  • tags/deluge-0.5.6.96/src/deluge_core.cpp

    r2304 r2317  
    17881788    return NULL; 
    17891789 
    1790   if (M_torrents->at(index).handle.is_valid()){ 
    1791       std::vector<libtorrent::announce_entry> trackerlist; 
    1792       std::istringstream trackers(tracker); 
    1793       std::string line; 
    1794       while (std::getline(trackers, line)) { 
    1795         libtorrent::announce_entry a_entry(line); 
    1796         trackerlist.push_back(a_entry); 
     1790  try { 
     1791      if (M_torrents->at(index).handle.is_valid()){ 
     1792        std::vector<libtorrent::announce_entry> trackerlist; 
     1793        std::istringstream trackers(tracker); 
     1794        std::string line; 
     1795        while (std::getline(trackers, line)) { 
     1796          libtorrent::announce_entry a_entry(line); 
     1797          trackerlist.push_back(a_entry); 
     1798        } 
     1799        if (trackerlist.empty()){ 
     1800            std::vector<libtorrent::announce_entry> empty; 
     1801            M_torrents->at(index).handle.replace_trackers(empty); 
     1802        } 
     1803        else{ 
     1804            M_torrents->at(index).handle.replace_trackers(trackerlist); 
     1805            M_torrents->at(index).handle.force_reannounce(); 
     1806        } 
    17971807      } 
    1798       if (trackerlist.empty()){ 
    1799           std::vector<libtorrent::announce_entry> empty; 
    1800           M_torrents->at(index).handle.replace_trackers(empty); 
    1801       } 
    1802       else{ 
    1803           M_torrents->at(index).handle.replace_trackers(trackerlist); 
    1804           M_torrents->at(index).handle.force_reannounce(); 
    1805       } 
    1806   } 
     1808    } 
     1809  catch (libtorrent::invalid_handle&) {} 
    18071810  Py_INCREF(Py_None); return Py_None; 
    18081811} 
  • trunk/src/deluge_core.cpp

    r2296 r2317  
    17881788    return NULL; 
    17891789 
    1790   if (M_torrents->at(index).handle.is_valid()){ 
    1791       std::vector<libtorrent::announce_entry> trackerlist; 
    1792       std::istringstream trackers(tracker); 
    1793       std::string line; 
    1794       while (std::getline(trackers, line)) { 
    1795         libtorrent::announce_entry a_entry(line); 
    1796         trackerlist.push_back(a_entry); 
     1790  try { 
     1791      if (M_torrents->at(index).handle.is_valid()){ 
     1792        std::vector<libtorrent::announce_entry> trackerlist; 
     1793        std::istringstream trackers(tracker); 
     1794        std::string line; 
     1795        while (std::getline(trackers, line)) { 
     1796          libtorrent::announce_entry a_entry(line); 
     1797          trackerlist.push_back(a_entry); 
     1798        } 
     1799        if (trackerlist.empty()){ 
     1800            std::vector<libtorrent::announce_entry> empty; 
     1801            M_torrents->at(index).handle.replace_trackers(empty); 
     1802        } 
     1803        else{ 
     1804            M_torrents->at(index).handle.replace_trackers(trackerlist); 
     1805            M_torrents->at(index).handle.force_reannounce(); 
     1806        } 
    17971807      } 
    1798       if (trackerlist.empty()){ 
    1799           std::vector<libtorrent::announce_entry> empty; 
    1800           M_torrents->at(index).handle.replace_trackers(empty); 
    1801       } 
    1802       else{ 
    1803           M_torrents->at(index).handle.replace_trackers(trackerlist); 
    1804           M_torrents->at(index).handle.force_reannounce(); 
    1805       } 
    1806   } 
     1808    } 
     1809  catch (libtorrent::invalid_handle&) {} 
    18071810  Py_INCREF(Py_None); return Py_None; 
    18081811}