Subscribe

Seeding Time

  1. 2009-12-05 05:17:16 PST
    I'm trying to update the source code to inject an incrementing time that the user has been seeding for. In the files_users buffer in server.cpp I am using this to define seeding_time: int seeding_time = 0; if (i != file.peers.end()) { if (time() > i->second.mtime && i->second.mtime > 0) { seeding_time=(time() - i->second.mtime); } } I'd also like to add **i->second.active** into the if statement so that I can ensure that it only changes the value when the torrent is active but this doesn't exist. I am a complete novice when it comes to C++ coding although I'm pretty skilled in php coding so I do understand some of it due to the similarities between the two, any chance of a pointer on how to add mtime to i->second?
  2. 2009-12-05 05:19:21 PST
    > any chance of a pointer on how to add > mtime to i->second? Should read: any chance of a pointer on how to add active to i->second?
  3. 2009-12-05 06:17:50 PST
    Active is defined as i->second.time > time() - static_cast<int>(1.5 * m_config.m_announce_interval)
  4. 2009-12-05 11:47:15 PST
    I tried this and it doesn't seem to work: int seeding_time = 0; int active = 0; if (i != file.peers.end()) { if (i->second.time > time() - static_cast<int>(1.5 * m_config.m_announce_interval)) { active=1; } if (time() > i->second.mtime && i->second.mtime > 0 && active == 1 ) { seeding_time=(time() - i->second.mtime); } } Updates are made to users even when active=0 in the database because for some reason the mtime value is under the timeout so XBT appears to be updating this value even for dead peers. Is there any way to use the actual value of active in the database rather than doing it this way? **PS thanks for your help so far, I appreciate it.**
  5. 2009-12-05 12:18:40 PST
    Active is set to 0 when the time out happens, so by definition active is true inside of insert_peer().
  6. 2009-12-06 05:12:51 PST
    OK there's something wrong with the data in the database then because I've tried changing the code to: int seeding_time = 0; if (i != file.peers.end() && boost::equals(i->second.peer_id, v.m_peer_id) && v.m_left == 0 && v.m_uploaded > i->second.uploaded && time() > i->second.mtime && i->second.mtime > 0) { seeding_time=(time() - i->second.mtime); } And there are still peers with **active** as 0 in the database but if they're getting updated then their uploaded totals have to be increasing. The only thing I can think of is the frontend's sanity check must have set the values to 0 and as XBT sets the value to it's current value then it never gets set it back to 1. I think I will use your definition to make sure the active value is correct rather than setting it to it's current value as it does right now. Thanks for your help, I think I can handle it from here.
  7. 2011-03-12 09:47:28 PST
    have you finished it?
Jump To:
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.