示例#1
0
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);
}