本文整理汇总了C++中channel::ptr::send方法的典型用法代码示例。如果您正苦于以下问题:C++ ptr::send方法的具体用法?C++ ptr::send怎么用?C++ ptr::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类channel::ptr
的用法示例。
在下文中一共展示了ptr::send方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_inventory_not_found
void responder::send_inventory_not_found(inventory_type_id type_id,
const hash_digest& hash, channel::ptr node, proxy::result_handler handler)
{
const inventory_vector block_inventory
{
type_id,
hash
};
const not_found lost{ { block_inventory } };
node->send(lost, handler);
}
示例2: send_tx
void responder::send_tx(const transaction& tx, const hash_digest& hash,
channel::ptr node)
{
const auto send_handler = [hash, node](const code& ec)
{
if (ec)
log::debug(LOG_RESPONDER)
<< "Failure sending tx for ["
<< node->authority() << "]";
else
log::debug(LOG_RESPONDER)
<< "Sent tx for [" << node->authority()
<< "] " << encode_hash(hash);
};
node->send(tx, send_handler);
}
示例3: send_block
// Should we look in the orphan pool first?
void responder::send_block(const code& ec, const block& block,
const hash_digest& block_hash, channel::ptr node)
{
if (ec == error::service_stopped)
return;
if (ec == error::not_found)
{
log::debug(LOG_RESPONDER)
<< "Block for [" << node->authority()
<< "] not in blockchain [" << encode_hash(block_hash) << "]";
// It wasn't in the blockchain, so send notfound.
send_block_not_found(block_hash, node);
}
if (ec)
{
log::error(LOG_RESPONDER)
<< "Failure fetching block data for ["
<< node->authority() << "] " << ec.message();
node->stop(ec);
return;
}
const auto send_handler = [block_hash, node](const code& ec)
{
if (ec)
log::debug(LOG_RESPONDER)
<< "Failure sending block for ["
<< node->authority() << "]";
else
log::debug(LOG_RESPONDER)
<< "Sent block for [" << node->authority()
<< "] " << encode_hash(block_hash);
};
node->send(block, send_handler);
}