本文整理汇总了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);
}
示例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);
}
示例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();
}