eclipse-iceoryx / eclipse-iceoryx/iceoryx2

How does a client efficiently know the server has responded it?

Open
#985 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.