-
Notifications
You must be signed in to change notification settings - Fork 526
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 fragment bug #316
fix fragment bug #316
Conversation
"id": request_object["id"], | ||
"data": service_response_data # put service response in "data"-field of response object (in this case it's twice "data", because response value is also named data (in srv-file) | ||
"values": service_response_data # put service response in "data"-field of response object (in this case it's twice "data", because response value is also named data (in srv-file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this comment need to be updated to refer to the new field name "values"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modifed is to repair service_response message error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I resubmit it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@WH-0501 You can just add the changes we've requested to the branch you created your Pull Request from, then push to it. The Pull Request will be updated automatically, no need to make a new one :)
@@ -169,7 +169,12 @@ def defragment(self, message): | |||
self.protocol.log("debug", log_msg) | |||
|
|||
# Reconstruct the message | |||
reconstructed_msg = ''.join(self.received_fragments[msg_id]["fragment_list"][0:message["total"]]) | |||
print(type(self.received_fragments[msg_id]["fragment_list"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
@@ -169,7 +169,12 @@ def defragment(self, message): | |||
self.protocol.log("debug", log_msg) | |||
|
|||
# Reconstruct the message | |||
reconstructed_msg = ''.join(self.received_fragments[msg_id]["fragment_list"][0:message["total"]]) | |||
print(type(self.received_fragments[msg_id]["fragment_list"])) | |||
#reconstructed_msg = ''.join(self.received_fragments[msg_id]["fragment_list"][0:message["total"]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the commented code
print(type(self.received_fragments[msg_id]["fragment_list"])) | ||
#reconstructed_msg = ''.join(self.received_fragments[msg_id]["fragment_list"][0:message["total"]]) | ||
reconstructed_msg = '' | ||
for key,value in self.received_fragments[msg_id]["fragment_list"].items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You're not checking the size bound from the message (
msg['total']
) any more - Please change your code back to use
''.join()
, as it's significantly faster (see https://waymoot.org/home/python_string/ )
@T045T, Thanks. How about this change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
@@ -56,7 +56,8 @@ def calculate_service_response(request): | |||
|
|||
response_object = { "op": "service_response", | |||
"id": request_object["id"], | |||
"data": service_response_data # put service response in "data"-field of response object (in this case it's twice "data", because response value is also named data (in srv-file) | |||
"service": service_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix the indentation in the merge commit :)
This PR fix the 的fragment bug while using the rosbridge_library/test/experimental/fragmentation+srv+tcp test.
First, self.received_fragments[msg_id]["fragment_list"] in defragmentation.py has type dict, but dict doesn't support slice.
Second, response_object in test_non-ros_service_server_fragmented.py doesn't has 'service' field, and the ‘data’ field should be 'values'