Fix for socket timeout reading tracker info from trackers that do not support scraping
File attached. Taken from the 0.972 branch.
The code ignores socket timeouts from tracker.openbittorrent.com only. Add other trackers if needed.
Snippet below. new code is between //start fix and //end fix.
Code:
//start fix.
try
{
torrentSeeders=5;
torrentLeechers=0;
TorrentState torrentState = torrent.getState(TedConfig.getInstance().getTimeOutInSecs());
torrentSeeders = getSeedersFromTorrent(torrentState);
torrentLeechers = getLeechersFromTorrent(torrentState);
}
catch (Exception e)
{
//if we cannot read seeders/leechers from a known tracker that does not allow scrapes, ignore the error
if(e.getMessage().indexOf("java.net.SocketTimeoutException: connect timed out")!=-1)
{
//TODO: add other known scrape-not-supporting trackers below. maybe use a property file
if(torrent.getTracker().getScrapeUrl().indexOf("tracker.openbittorrent.com")>-1)
{
TedLog.simpleLog("Socket timeout scraping a known non-responsive tracker.tracker:"+torrent.getTracker().getScrapeUrl()+" (continuing!");
}
else
{
TedLog.simpleLog("Socket timeout reading tracker:"+torrent.getTracker().getScrapeUrl()+" (Please ask the dev team to add an ignore if needed)");
throw e;
}
}
}
//end fix.
Thanks for a great tool, and keeping it 1)java 2)open source