本文整理汇总了C++中incoming_message::origin方法的典型用法代码示例。如果您正苦于以下问题:C++ incoming_message::origin方法的具体用法?C++ incoming_message::origin怎么用?C++ incoming_message::origin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类incoming_message
的用法示例。
在下文中一共展示了incoming_message::origin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_renew
void subscribe_manager::do_renew(
const incoming_message& request, queue_send_callback queue_send)
{
payment_address addr_key;
if (!deserialize_address(addr_key, request.data()))
{
log_warning(LOG_SUBSCRIBER) << "Incorrect format for subscribe renew.";
return;
}
const posix_time::ptime now = second_clock::universal_time();
// Find entry and update expiry_time.
auto range = subs_.equal_range(addr_key);
for (auto it = range.first; it != range.second; ++it)
{
subscription& sub = it->second;
// Only update subscriptions which were created by
// the same client as this request originated from.
if (sub.client_origin != request.origin())
continue;
// Future expiry time.
sub.expiry_time = now + sub_expiry;
}
// Send response.
data_chunk result(4);
auto serial = make_serializer(result.begin());
write_error_code(serial, std::error_code());
outgoing_message response(request, result);
queue_send(response);
}
示例2: process_filters
bool backend_cluster::process_filters(const incoming_message& response)
{
auto filter_it = filters_.find(response.command());
if (filter_it == filters_.end())
return false;
filter_it->second(response.data(), response.origin());
return true;
}
示例3: process_as_reply
bool backend_cluster::process_as_reply(const incoming_message& response)
{
auto handle_it = handlers_.find(response.id());
// Unknown response. Not in our map.
if (handle_it == handlers_.end())
return false;
handle_it->second(response.data(), response.origin());
handlers_.erase(handle_it);
size_t n_erased = retry_queue_.erase(response.id());
BITCOIN_ASSERT(n_erased == 1);
return true;
}
示例4: add_subscription
std::error_code subscribe_manager::add_subscription(
const incoming_message& request, queue_send_callback queue_send)
{
payment_address addr_key;
if (!deserialize_address(addr_key, request.data()))
{
log_warning(LOG_SUBSCRIBER) << "Incorrect format for subscribe data.";
return error::bad_stream;
}
// Now create subscription.
const posix_time::ptime now = second_clock::universal_time();
// Limit absolute number of subscriptions to prevent exhaustion attacks.
if (subs_.size() >= subscribe_limit_)
return error::pool_filled;
subs_.emplace(addr_key, subscription{
now + sub_expiry, request.origin(), queue_send});
return std::error_code();
}
示例5: do_subscribe
void subscribe_manager::do_subscribe(
const incoming_message& request, zmq_socket_ptr socket)
{
payment_address addr_key;
if (!deserialize_address(addr_key, request.data()))
{
log_warning(LOG_SUBSCRIBER) << "Incorrect format for subscribe data.";
return;
}
// Now create subscription.
const posix_time::ptime now = second_clock::universal_time();
subs_.emplace(addr_key, subscription{
now + sub_expiry, request.origin(), socket});
// Send response.
data_chunk result(4);
auto serial = make_serializer(result.begin());
write_error_code(serial, std::error_code());
outgoing_message response(request, result);
response.send(*socket);
}
示例6:
outgoing_message::outgoing_message(
const incoming_message& request, const data_chunk& data)
: dest_(request.origin()), command_(request.command()),
id_(request.id()), data_(data)
{
}