Class AnnounceInfohash

java.lang.Object
com.frostwire.jlibtorrent.AnnounceInfohash

public class AnnounceInfohash extends Object
Announcement status for a specific info-hash at a tracker endpoint.

AnnounceInfohash tracks the status of an individual info-hash (torrent) being announced to a specific tracker. It records the tracker's response, error messages, failure count, and whether an announcement is currently in progress for that info-hash.

Understanding Announce Status:
BitTorrent trackers require periodic announcements with torrent metadata. Multiple info-hashes may be announced to the same tracker through different endpoints:

  • Message: Last error or warning message from tracker
  • Fails: Count of consecutive failed announcements
  • Updating: Whether announcement is currently in progress
  • Working: Whether the tracker is responding successfully

Monitoring Announce Status:

 // Get tracker status for a torrent
 TorrentHandle th = sm.find(infoHash);
 TorrentStatus status = th.status();

 // Access announce info-hashes for trackers
 java.util.List<AnnounceEndpoint> endpoints = status.announceEndpoints();

 for (AnnounceEndpoint endpoint : endpoints) {
     // Each endpoint has info-hashes being announced
     java.util.List<AnnounceInfohash> infoHashes = endpoint.infoHashes();

     for (AnnounceInfohash ih : infoHashes) {
         System.out.println(\"Announce Status:\");
         System.out.println(\"  Updating: \" + ih.updating());
         System.out.println(\"  Fails: \" + ih.fails());
         System.out.println(\"  Working: \" + ih.isWorking());
         if (!ih.message().isEmpty()) {
             System.out.println(\"  Message: \" + ih.message());
         }
     }
 }
 

Interpreting Announcement States:

 AnnounceInfohash ih = ...;

 // Is an announcement currently being sent?
 if (ih.updating()) {
     System.out.println(\"Announcement in progress...\");
 }

 // Has it succeeded?
 if (ih.isWorking()) {
     System.out.println(\"Tracker is responding correctly\");
     System.out.println(\"Consecutive failures: 0\");
 } else {
     // Count indicates how many times announcement failed
     System.out.println(\"Tracker failed \" + ih.fails() + \" times in a row\");

     // Check for error message
     String msg = ih.message();
     if (!msg.isEmpty()) {
         System.out.println(\"Error: \" + msg);
     }
 }
 

Failure and Recovery:

 // Track consecutive failures
 AnnounceInfohash ih = ...;

 short failCount = ih.fails();\n * if (failCount == 0) {
     // Tracker working normally
     System.out.println(\"OK\");
 } else if (failCount < 5) {
     // Transient failures, may recover
     System.out.println(\"Tracker unstable: \" + failCount + \" failures\");
 } else {
     // Many failures, likely connectivity or tracker issue
     System.out.println(\"Tracker appears down: \" + failCount + \" failures\");
     System.out.println(\"Last message: \" + ih.message());
 }
 

Tracker Endpoint Structure:

Trackers are organized hierarchically:

  • Tracker URLEndpoints (IP/port combinations)
  • EndpointInfo-hashes (torrents being announced)
  • AnnounceInfohash → Status of single info-hash at endpoint

Performance Notes:

  • Failure counter resets on successful announcement
  • Multiple info-hashes may share same tracker endpoint connection
  • Messages indicate tracker-returned warnings or errors
  • Status is updated continuously by libtorrent's announce thread
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    AnnounceInfohash(com.frostwire.jlibtorrent.swig.announce_infohash infohash)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    short
    The number of times in a row we have failed to announce to this tracker.
    boolean
    Returns true if the last time we tried to announce to this tracker succeeded, or if we haven't tried yet.
    If this tracker has returned an error or warning message that message is stored here.
    boolean
    Returns true while we're waiting for a response from the tracker.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AnnounceInfohash

      public AnnounceInfohash(com.frostwire.jlibtorrent.swig.announce_infohash infohash)
  • Method Details

    • message

      public String message()
      If this tracker has returned an error or warning message that message is stored here.
      Returns:
      the error or warning message
    • fails

      public short fails()
      The number of times in a row we have failed to announce to this tracker.
      Returns:
      number of announce fails
    • updating

      public boolean updating()
      Returns true while we're waiting for a response from the tracker.
      Returns:
      true if waiting
    • isWorking

      public boolean isWorking()
      Returns true if the last time we tried to announce to this tracker succeeded, or if we haven't tried yet.