Giter VIP home page Giter VIP logo

i2p.plugins.i2psnark-rpc's People

Contributors

eyedeekay avatar zzzi2p avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

i2p.plugins.i2psnark-rpc's Issues

this pluggin not fully implement transmission rpc-spec

here is spec: https://github.com/transmission/transmission/blob/2.8x/extras/rpc-spec.txt#L281-L308

and here is commented code which followed spec

/****
private Object torrentGet_trackerStats(Snark download) {
List tracker_stats = new ArrayList();
List<TrackerPeerSource> trackerPeerSources = core_download.getTrackerPeerSources();
if (trackerPeerSources == null) {
return tracker_stats;
}
for (TrackerPeerSource tps : trackerPeerSources) {
String statusString = tps.getStatusString();
if (statusString == null) {
statusString = "";
}
Map<String, Object> map = new HashMap<String, Object>( 64 );
// how many downloads this tracker knows of (-1 means it does not know)
map.put("downloadCount", -1); // TODO
// whether or not we've ever sent this tracker an announcement
map.put("hasAnnounced", tps.getPeers() >= 0); // TODO
// whether or not we've ever scraped to this tracker
map.put("hasScraped", false); // todo: bool);
String name = "";
try {
name = tps.getName();
} catch (Exception e) {
// NPE at com.aelitis.azureus.plugins.extseed.ExternalSeedPlugin$5.getName(ExternalSeedPlugin.java:561
}
// human-readable string identifying the tracker
map.put("host", name); // TODO
// the full announce URL
map.put("announce", name); // TODO
// the full scrape URL
map.put("scrape", name); // TODO
// Transmission uses one tracker per tier,
// and the others are kept as backups
map.put("isBackup", false); // TODO
// is the tracker announcing, waiting, queued, etc
int status = tps.getStatus();
int state;
if (status == tps.ST_AVAILABLE || status == tps.ST_ONLINE) {
state = TR_TRACKER_WAITING;
} else if (status == tps.ST_UPDATING) {
state = TR_TRACKER_ACTIVE;
} else if (status == tps.ST_QUEUED) {
state = TR_TRACKER_QUEUED;
} else {
state = TR_TRACKER_INACTIVE;
}
map.put("announceState", state);
// is the tracker scraping, waiting, queued, etc
map.put("scrapeState", state);
// number of peers the tracker told us about last time.
// if "lastAnnounceSucceeded" is false, this field is undefined
map.put("lastAnnouncePeerCount", tps.getPeers());
// human-readable string with the result of the last announce.
// if "hasAnnounced" is false, this field is undefined
if (statusString != null) {
map.put("lastAnnounceResult", statusString);
}
// when the last announce was sent to the tracker.
// if "hasAnnounced" is false, this field is undefined
map.put("lastAnnounceStartTime", 0); // TODO: time_t);
// whether or not the last announce was a success.
// if "hasAnnounced" is false, this field is undefined
map.put("lastAnnounceSucceeded", tps.getPeers() >= 0);
// whether or not the last announce timed out.
map.put("lastAnnounceTimedOut", false); // TODO
// when the last announce was completed.
.. if "hasAnnounced" is false, this field is undefined
map.put("lastAnnounceTime", 0); // TODO: time_t);
// human-readable string with the result of the last scrape.
// if "hasScraped" is false, this field is undefined
if (statusString != null) {
map.put("lastScrapeResult", statusString);
}
// when the last scrape was sent to the tracker.
// if "hasScraped" is false, this field is undefined/
map.put("lastScrapeStartTime", 0); // TODO: time_t);
// whether or not the last scrape was a success.
// if "hasAnnounced" is false, this field is undefined
map.put("lastScrapeSucceeded", tps.getPeers() >= 0);
// whether or not the last scrape timed out.
map.put("lastScrapeTimedOut", false); // TODO: bool);
// when the last scrape was completed.
// if "hasScraped" is false, this field is undefined
map.put("lastScrapeTime", 0); // TODO: time_t);
// number of leechers this tracker knows of (-1 means it does not know)
map.put("leecherCount", tps.getLeecherCount());
// when the next periodic announce message will be sent out.
// if announceState isn't TR_TRACKER_WAITING, this field is undefined
map.put("nextAnnounceTime", 0); // TODO: time_t);
// when the next periodic scrape message will be sent out.
// if scrapeState isn't TR_TRACKER_WAITING, this field is undefined
map.put("nextScrapeTime", 0); // TODO: time_t);
// number of seeders this tracker knows of (-1 means it does not know)
map.put("seederCount", tps.getSeedCount());
// which tier this tracker is in
map.put("tier", 0); // TODO: int);
// used to match to a tr_tracker_info
map.put("id", tps.hashCode());
tracker_stats.add(map);
}
return tracker_stats;
}
****/

but here is used another function

} else if (field.equals("trackerStats")) {
// RPC v7
//value = torrentGet_trackerStats(core_download);
// just do the same as 'trackers' for now
String agent = request.getHeader("User-Agent");
boolean hack = agent != null && agent.contains("httpok"); // Torrnado
value = torrentGet_trackers(download, hack);

// just do the same as 'trackers' for now

why?


and due to this rpc returns incomplete response

{
 'trackerStats': [{'announce': '...',
                   'id': 687183153,
                   'scrape': '',
                   'tier': 0}],
}

which causes issues like this rndusr/stig/pull/215

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.