Bitcoin full node and query server

Jan 11, 2021

View in context in the libbitcoin Slack #general mirror.

N
narodnik16:42
void session::start_channel(channel::ptr channel,
    result_handler handle_started)
{
    channel->set_notify(notify_on_connect_);
    channel->set_nonce(pseudo_random::next(1, max_uint64));

    // The channel starts, invokes the handler, then starts the read cycle.
    channel->start(
        BIND3(handle_starting, _1, channel, handle_started));
}

void session::handle_starting(const code& ec, channel::ptr channel,
    result_handler handle_started)
{
    if (ec)
    {
        LOG_DEBUG(LOG_NETWORK)
            << "Channel failed to start [" << channel->authority() << "] "
            << ec.message();
        handle_started(ec);
        return;
    }

    attach_handshake_protocols(channel,
        BIND3(handle_handshake, _1, channel, handle_started));
}