Beispiel #1
0
function evilReject($ip, $peer_id, $port)
{
    // For those of you who are feeling evil, comment out this line.
    showError("Torrent is not authorized for use on this tracker.");
    $peers[0]["peer_id"] = $peer_id;
    $peers[0]["ip"] = $ip;
    $peers[0]["port"] = $port;
    $peers["size"] = 1;
    $GLOBALS["report_interval"] = 86400;
    $GLOBALS["min_interval"] = 86000;
    sendPeerList($peers);
    exit(0);
}
Beispiel #2
0
        }
        if ($peer_exists["bytes"] != 0 && $left == 0) {
            quickQuery("UPDATE peers SET bytes = 0, status = 'seeder' WHERE sequence = '" . $GLOBALS['trackerid'] . "' AND infohash = '" . $info_hash . "'");
            if ($db->affected_rows == 1) {
                summaryAdd("leechers", -1);
                summaryAdd("seeds", 1);
                summaryAdd("finished", 1);
                summaryAdd("lastcycle", "UNIX_TIMESTAMP()", true);
            }
        }
        collectBytes($peer_exists, $info_hash, $left, $downloaded, $uploaded, $pid);
        if ($GLOBALS["peercaching"]) {
            sendRandomPeers($info_hash);
        } else {
            $peers = getRandomPeers($info_hash, '');
            sendPeerList($peers);
        }
        break;
        // not valid event
    // not valid event
    default:
        show_error("Invalid event = from client.");
}
if ($GLOBALS["countbytes"]) {
    // Once every minute or so, we run the speed update checker.
    $results = MCached::get('ann::count::bytes::' . $info_hash);
    if ($results === MCached::NO_RESULT) {
        $query = @$db->query("SELECT UNIX_TIMESTAMP() - lastSpeedCycle FROM summary WHERE info_hash = '" . $info_hash . "'");
        $results = $query->fetch_row();
        MCached::add('count::bytes::' . $info_hash, $results, 300);
    }