当前位置: 首页>>代码示例>>C++>>正文


C++ ptr::address方法代码示例

本文整理汇总了C++中channel::ptr::address方法的典型用法代码示例。如果您正苦于以下问题:C++ ptr::address方法的具体用法?C++ ptr::address怎么用?C++ ptr::address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在channel::ptr的用法示例。


在下文中一共展示了ptr::address方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handle_accept

void protocol::handle_accept(const code& ec, channel::ptr node,
    acceptor::ptr accept)
{
    // Relisten for connections.
    start_accept(ec, accept);

    if (ec)
    {
        log_debug(LOG_PROTOCOL)
            << "Failure accepting connection: " << ec.message();
        return;
    }

    if (inbound_connections_.size() >= max_inbound_)
    {
        log_debug(LOG_PROTOCOL)
            << "Rejected inbound connection due to connection limit";
        return;
    }

    const auto address = node->address();
    if (is_blacklisted(node->address()))
    {
        log_debug(LOG_PROTOCOL)
            << "Rejected inbound connection due to blacklisted address";
        return;
    }

    if (is_loopback(node))
    {
        log_debug(LOG_PROTOCOL)
            << "Rejected inbound connection from self";
        return;
    }

    // Save the connection as we are now assured of getting stop event.
    inbound_connections_.push_back(node);

    // Accepted!
    log_info(LOG_PROTOCOL)
        << "Accepted connection from [" << address << "] ("
        << inbound_connections_.size() << " total)";

    const auto stop_handler = 
        dispatch_.ordered_delegate(&protocol::inbound_channel_stopped,
            this, _1, node, address.to_string());

    start_talking(node, stop_handler, relay_);
}
开发者ID:cissp0,项目名称:libbitcoin,代码行数:49,代码来源:protocol.cpp

示例2: handle_handshake

void protocol::handle_handshake(const code& ec, channel::ptr node)
{
    if (ec)
    {
        log_debug(LOG_PROTOCOL) << "Failure in peer handshake ["
            << node->address() << "] " << ec.message();
        node->stop(ec);
        return;
    }

    // Attach ping protocol to the new connection (until node stop event).
    std::make_shared<protocol_ping>(node, pool_, timeouts_.heartbeat)->start();

    // Attach address protocol to the new connection (until node stop event).
    std::make_shared<protocol_address>(node, pool_, hosts_, self_)->start();
}
开发者ID:cissp0,项目名称:libbitcoin,代码行数:16,代码来源:protocol.cpp


注:本文中的channel::ptr::address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。