Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix service behavior when the service is an empty input (e.g. std_srvs/Trigger) #75

Merged

Conversation

chachi
Copy link
Contributor

@chachi chachi commented Feb 19, 2019

  • Change decoding of service request from a while loop to explicit if statement
  • Do not call service handler on tcp probe connection

- Change decoding of service request from a while loop to explicit if statement
- Do not call service handler on tcp probe connection
@@ -157,7 +172,7 @@ where
// TODO: validate message length
let _length = stream.read_u32::<LittleEndian>();
// Break out of loop in case of failure to read request
while let Ok(req) = RosMsg::decode(&mut stream) {
if let Ok(req) = RosMsg::decode(&mut stream) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't clients able to send multiple requests via the same connection to a service?
That method greatly reduces communication overhead, since header exchanges can often be much larger than the actual service payloads.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch, you're right this does prevent persistent connections.

Looks like service_client_link.cpp is where roscpp handles these things. I see two differences from service.rs:

  1. It looks for "persistent" in the header to know whether there might be more messages.
  2. It reads the length of the message before each new message is deserialized.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you just leave a TODO above the if line, and I can take on handling both cases

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nvm, I've just made an issue and will handle it afterwards.

@adnanademovic adnanademovic merged commit 036b885 into adnanademovic:master Mar 3, 2019
@chachi chachi deleted the fix-empty-service-msg branch March 4, 2019 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants