eclipse-iceoryx / eclipse-iceoryx/iceoryx2
How does a client efficiently know the server has responded it?
- Dominant language
- Rust
- Stars
- 2.5k
- Forks
- 185
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 32
Description
In request/response message pattern, the clients send request and notify the server. The server gets the notification and receives the request and send response back to client. The question is: how does a client efficiently know the server has responded it?
In my current design, the client polls to check if the response has arrived, if yes, receive it. But this method is not efficient.
loop {
if pending_response.has_response() || !pending_response.is_connected() {
break;
}
std::thread::sleep(Duration::from_millis(POLL_INTERVAL_MS));
}
I tried to use the listener to wait for the response. However, when the server sends out a notification, all of the clients will receive it, how does the client know this is for it or for others?
Is there any method like this in classic iceoryx:
waitset.attachState(client, iox::popo::ClientState::HAS_RESPONSE).or_else([](auto) {
std::cerr << "failed to attach client" << std::endl;
std::exit(EXIT_FAILURE);
});
Contributor guide
Assessment
This issue has not been assessed yet.