예제 #1
0
파일: funcsv2.php 프로젝트: j3k0/Wobi
function trashCollector($hash, $timeout)
{
    require "config.php";
    //need to grab prefix value...
    if (isset($GLOBALS["trackerid"])) {
        unset($GLOBALS["trackerid"]);
    }
    if (!Lock($hash)) {
        return;
    }
    $results = mysql_query("SELECT lastcycle FROM " . $prefix . "summary WHERE info_hash='{$hash}'");
    $lastcheck = mysql_fetch_row($results);
    // Check once every re-announce cycle
    if ($lastcheck[0] + $timeout < time()) {
        $peers = loadLostPeers($hash, $timeout);
        for ($i = 0; $i < $peers["size"]; $i++) {
            killPeer($peers[$i]["peer_id"], $hash, $peers[$i]["bytes"]);
        }
        summaryAdd("lastcycle", "UNIX_TIMESTAMP()", true);
    }
    Unlock($hash);
}
function myTrashCollector($hash, $timeout, $now, $writeout)
{
    $peers = loadLostPeers($hash, $timeout);
    for ($i = 0; $i < $peers["size"]; $i++) {
        killPeer($peers[$i]["peer_id"], $hash, $peers[$i]["bytes"], $peers[$i]);
    }
    if ($i != 0) {
        echo "<td>Removed {$i}</td>";
    } else {
        echo "<td>Removed 0</td>";
    }
    quickQuery("UPDATE BTPHP_summary SET lastcycle='{$now}' WHERE info_hash='{$hash}'");
}
예제 #3
0
function trashCollector($hash, $timeout)
{
    global $db;
    if (isset($GLOBALS["trackerid"])) {
        unset($GLOBALS["trackerid"]);
    }
    if (!Lock($hash)) {
        return;
    }
    $results = $db->query("SELECT lastcycle FROM summary WHERE info_hash = '" . $hash . "'");
    $lastcheck = $results->fetch_row();
    // Check once every re-announce cycle
    if ($lastcheck[0] + $timeout < vars::$timestamp) {
        $peers = loadLostPeers($hash, $timeout);
        for ($i = 0; $i < $peers["size"]; $i++) {
            killPeer($peers[$i]["peer_id"], $hash, $peers[$i]["bytes"]);
        }
        summaryAdd("lastcycle", "UNIX_TIMESTAMP()", true);
    }
    Unlock($hash);
}
function checkForStalePeers($hash, $timeout, $now, $cellBG, $outputHTML = false)
{
    /*
     * Get a list of stale peers...
     */
    $peers = loadLostPeers($hash, $timeout);
    /*
     * ... and remove them
     */
    for ($i = 0; $i < $peers["size"]; $i++) {
        killPeer($peers[$i]["peer_id"], $hash, $peers[$i]["bytes"], $peers[$i]);
    }
    /*
     * Show status, if needed...
     */
    if ($outputHTML) {
        if ($i != 0) {
            echo "\t\t<TD CLASS=\"consistency\">Removed {$i}</TD>\r\n";
        } else {
            echo "\t\t<TD {$cellBG}>Removed 0</TD>\r\n";
        }
    }
    quickQuery("UPDATE summary SET lastcycle='{$now}' WHERE info_hash='{$hash}'");
}
예제 #5
0
function myTrashCollector($hash, $timeout, $now, $writeout)
{
    $peers = loadLostPeers($hash, $timeout);
    for ($i = 0; $i < $peers["size"]; $i++) {
        killPeer($peers[$i]["peer_id"], $hash, $peers[$i]["bytes"], $peers[$i]);
    }
    quickQuery("UPDATE " . $prefix . "summary SET lastcycle='{$now}' WHERE info_hash='{$hash}'");
}
예제 #6
0
파일: sanity.php 프로젝트: j3k0/Wobi
function myTrashCollector($hash, $timeout, $now, $writeout)
{
    //	error_log("Trash collector working on $hash");
    require "config.php";
    $peers = loadLostPeers($hash, $timeout);
    for ($i = 0; $i < $peers["size"]; $i++) {
        killPeer($peers[$i]["peer_id"], $hash, $peers[$i]["bytes"], $peers[$i]);
    }
    if ($i != 0) {
        echo "<td class=\"center\">Removed {$i}</td>";
    } else {
        echo "<td class=\"center\">Removed 0</td>";
    }
    quickQuery("UPDATE " . $prefix . "summary SET lastcycle='{$now}' WHERE info_hash='{$hash}'");
}