Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class ServiceIntraProcess : public ServiceIntraProcessBase
// we are overloading the rmw_request_id semantics to provide the intra process client ID.
auto req_id = std::make_shared<rmw_request_id_t>();
req_id->sequence_number = intra_process_client_id;
req_id->from_intra_process = true;

SharedResponse response = any_callback_.dispatch(serv_handle, req_id, std::move(typed_request));

Expand Down
8 changes: 6 additions & 2 deletions rclcpp/include/rclcpp/service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,12 @@ class Service
void
send_response(rmw_request_id_t & req_id, typename ServiceT::Response & response)
{
if (use_intra_process_)
{
if (!use_intra_process_ && req_id.from_intra_process) {
throw std::invalid_argument(
"intraprocess request incompatible with non-intraprocess service");
}

if (use_intra_process_ && req_id.from_intra_process) {
auto intra_response = std::make_shared<typename ServiceT::Response>(response);
// The sequence number here is used as a proxy for the intra-process client ID
service_intra_process_->send_response(req_id.sequence_number, intra_response);
Expand Down