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


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

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


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

示例1: handle_start

void session::handle_start(const code& ec, channel::ptr channel,
    result_handler handle_started, result_handler handle_stopped)
{
    // Must either stop or subscribe the channel for stop before returning.
    if (ec)
        channel->stop(ec);
    else
        channel->subscribe_stop(handle_stopped);

    // This is the end of the registration sequence.
    handle_started(ec);
}
开发者ID:RojavaCrypto,项目名称:libbitcoin-network,代码行数:12,代码来源:session.cpp

示例2: handle_start

void session::handle_start(const code& ec, channel::ptr channel,
    result_handler handle_started, result_handler handle_stopped)
{
    // Must either stop or subscribe the channel for stop before returning.
    // All closures must eventually be invoked as otherwise it is a leak.
    // Therefore upon start failure expect start failure and stop callbacks.
    if (ec)
    {
        channel->stop(ec);
        handle_stopped(ec);
    }
    else
    {
        channel->subscribe_stop(
            BIND_3(do_remove, _1, channel, handle_stopped));
    }

    // This is the end of the registration sequence.
    handle_started(ec);
}
开发者ID:libbitcoin,项目名称:libbitcoin-network,代码行数:20,代码来源:session.cpp

示例3: start_talking

void protocol::start_talking(channel::ptr node,
    proxy::stop_handler handle_stop, bool relay)
{
    node->subscribe_stop(handle_stop);

    // Notify protocol subscribers of new channel.
    channel_subscriber_->relay(error::success, node);

    const auto callback = 
        dispatch_.ordered_delegate(&protocol::handle_handshake,
            this, _1, node);

    // TODO: set height.
    const uint32_t blockchain_height = 0;

    // Attach version protocol to the new connection (until complete).
    std::make_shared<protocol_version>(node, pool_, timeouts_.handshake,
        callback, hosts_, self_, blockchain_height, relay)->start();

    // Start reading from the socket (causing subscription events).
    node->start();
}
开发者ID:cissp0,项目名称:libbitcoin,代码行数:22,代码来源:protocol.cpp


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