Add ThriftHandle::DeliverMessage method

This commit is contained in:
Tyler Neely 2022-08-11 17:02:21 +00:00
parent d05d649924
commit 60dfafcb5f

View File

@ -35,6 +35,18 @@ class ThriftHandle {
std::map<Address, void> clients_;
public:
template <Message M>
void DeliverMessage(Address from_address, RequestId request_id, M &&message) {
{
std::unique_lock<std::mutex> lock(mu_);
std::any message_any(std::move(message));
OpaqueMessage om{.from_address = from_address, .request_id = request_id, .message = std::move(message_any)};
can_receive_.emplace_back(std::move(om));
} // lock dropped
cv_.notify_all();
}
template <Message Request, Message Response>
void SubmitRequest(Address to_address, Address from_address, RequestId request_id, Request &&request,
Duration timeout, ResponsePromise<Response> &&promise) {