message: rename send_message_abortable to send_message_cancellable
It's not possible to abort an RPC call entirely, since the remote part continues running (if the message got out). Calling the provided abort source does the following: 1. if the message is still in the outgoing queue, drop it, 2. resolve waiter callbacks exceptionally. Using the word "cancellable" is more appropriate. Also write a small comment at `send_message_cancellable`.
This commit is contained in:
@@ -994,7 +994,7 @@ future<> messaging_service::send_gossip_echo(msg_addr id, int64_t generation_num
|
||||
return send_message_timeout<void>(this, messaging_verb::GOSSIP_ECHO, std::move(id), timeout, generation_number);
|
||||
}
|
||||
future<> messaging_service::send_gossip_echo(msg_addr id, int64_t generation_number, abort_source& as) {
|
||||
return send_message_abortable<void>(this, messaging_verb::GOSSIP_ECHO, std::move(id), as, generation_number);
|
||||
return send_message_cancellable<void>(this, messaging_verb::GOSSIP_ECHO, std::move(id), as, generation_number);
|
||||
}
|
||||
|
||||
void messaging_service::register_gossip_shutdown(std::function<rpc::no_wait_type (inet_address from, rpc::optional<int64_t> generation_number)>&& func) {
|
||||
|
||||
@@ -177,9 +177,11 @@ auto send_message_timeout(messaging_service* ms, messaging_verb verb, msg_addr i
|
||||
});
|
||||
}
|
||||
|
||||
// Requesting abort on the provided abort_source drops the message from the outgoing queue (if it's still there)
|
||||
// and causes the returned future to resolve exceptionally with `abort_requested_exception`.
|
||||
// TODO: Remove duplicated code in send_message
|
||||
template <typename MsgIn, typename... MsgOut>
|
||||
auto send_message_abortable(messaging_service* ms, messaging_verb verb, msg_addr id, abort_source& as, MsgOut&&... msg) {
|
||||
auto send_message_cancellable(messaging_service* ms, messaging_verb verb, msg_addr id, abort_source& as, MsgOut&&... msg) {
|
||||
auto rpc_handler = ms->rpc()->make_client<MsgIn(MsgOut...)>(verb);
|
||||
if (ms->is_shutting_down()) {
|
||||
using futurator = futurize<std::result_of_t<decltype(rpc_handler)(rpc_protocol::client&, MsgOut...)>>;
|
||||
|
||||
Reference in New Issue
Block a user