It is currently Sat Nov 26, 2011 7:59 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Fix for socket timeout reading tracker info
PostPosted: Wed May 04, 2011 3:01 am 
Offline

Joined: Tue May 03, 2011 8:41 pm
Posts: 7
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


Attachments:
TedParser.zip [14.5 KiB]
Downloaded 27 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group