Skip to content

Commit

Permalink
rpc: signal send completion even if send failed due to a socket error
Browse files Browse the repository at this point in the history
When call to marshall fails with an exception the exception future is
stored in dst.out_ready(). During next send sent future will not be
signaled because marshall() will never be called. Fix that by moving
sent future signaling to consider dst.out_ready() state too.
  • Loading branch information
gleb-cloudius authored and avikivity committed Apr 22, 2015
1 parent 5d658cf commit 349f21c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rpc/rpc_impl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ auto send_helper(MsgType t, std::index_sequence<I...>) {
promise<> sent; // will be fulfilled when data is sent
auto fsent = sent.get_future();
dst.out_ready() = dst.out_ready().then([&dst, xargs = std::move(xargs), m = std::move(m), sent = std::move(sent)] () mutable {
return marshall(dst.serializer(), dst.out(), std::move(xargs)).then([m = std::move(m)] {}).finally([sent = std::move(sent)] () mutable {
sent.set_value();
});
return marshall(dst.serializer(), dst.out(), std::move(xargs)).then([m = std::move(m)] {});
}).finally([sent = std::move(sent)] () mutable {
sent.set_value();
});

// prepare reply handler, if return type is now_wait_type this does nothing, since no reply will be sent
Expand Down

0 comments on commit 349f21c

Please sign in to comment.