コード例 #1
0
ファイル: EndpointPool.cpp プロジェクト: dioptre/libcoin
bool EndpointPool::addEndpoint(Endpoint endpoint, int64_t penalty)
{
    if (!endpoint.isRoutable())
        return false;
    if (endpoint.getIP() == _localhost.getIP())
        return false;
    endpoint.setTime(max((int64_t)0, (int64_t)endpoint.getTime() - penalty));
    Endpoint found = endpoint;
    
    query("INSERT OR REPLACE INTO Endpoints VALUES (?, ?, ?, ?)", (int64_t)endpoint.getIP(), (int64_t)endpoint.getPort(), (int64_t)endpoint.getTime(), 0);
    
    return true;
}
コード例 #2
0
ファイル: EndpointPool.cpp プロジェクト: dioptre/libcoin
void EndpointPool::setLastTry(const Endpoint& ep) {
    int64_t now = GetAdjustedTime();
    query("UPDATE Endpoints SET lasttry = ? WHERE ip = ? AND port = ?", now, (int64_t)ep.getIP(), ep.getPort());
}
コード例 #3
0
ファイル: EndpointPool.cpp プロジェクト: dioptre/libcoin
void EndpointPool::currentlyConnected(const Endpoint& ep)
{
    int64_t now = GetAdjustedTime();

    query("UPDATE Endpoints SET time = ? WHERE ip = ? AND port = ?", now, (int64_t)ep.getIP(), ep.getPort());
}