예제 #1
0
파일: p2p.cpp 프로젝트: zauguin/libbitcoin
static int connect_result(p2p& network, const config::endpoint& host)
{
    std::promise<code> promise;
    const auto handler = [&promise](const code& ec, channel::ptr)
    {
        promise.set_value(ec);
    };
    network.connect(host.host(), host.port(), handler);
    return promise.get_future().get().value();
}
예제 #2
0
void protocol::retry_manual_connection(const config::endpoint& address,
    bool relay, size_t retry)
{
    const auto done = (retry == 1);
    if (done)
    {
        log_warning(LOG_PROTOCOL)
            << "Failure connecting [" << address << "] retries exceeded";
        return;
    }

    const auto forever = (retry == 0);
    const auto retries = forever ? 0 : retry - 1;
    maintain_connection(address.host(), address.port(), relay, retries);
}
예제 #3
0
void p2p::connect(const config::endpoint& peer)
{
    connect(peer.host(), peer.port());
}
예제 #4
0
void connector::connect(const config::endpoint& endpoint,
    connect_handler handler)
{
    connect(endpoint.host(), endpoint.port(), handler);
}