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

WIP: Explicit session lifecycle for the serial server. #228

Merged
merged 1 commit into from
Jul 12, 2016

Conversation

mikepurvis
Copy link
Member

@mikepurvis mikepurvis commented Jul 6, 2016

This is a long overdue change which will resolve some crashes when USB serial devices return error states in the face or noise or other interruptions.

This is a work in progress— once support for the socket server is in place, this will represent a resolution to #172.

FYI: @mitchellwills @mikeodr

@@ -45,81 +45,63 @@
namespace rosserial_server
{

class SerialSession : public Session<boost::asio::serial_port>
class SerialSession
{
public:
SerialSession(boost::asio::io_service& io_service, std::string port, int baud)
Copy link
Member Author

Choose a reason for hiding this comment

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

Realistically, this is no longer a "Session", it's now a session manager. However, for the sake of not breaking API for other nodes which embed rosserial_server, it will remain as it is.

@mikepurvis mikepurvis force-pushed the explicit-session-lifecycle branch 5 times, most recently from 5f8525a to 1eb322b Compare July 12, 2016 16:25
@mikepurvis
Copy link
Member Author

Despite the large size of this, I don't think it's a terribly risky change, and resolves some significant crashes for us. Going to merge to jade-devel as-is, and then bloom for Kinetic. If there are no reported issues, then Jade will be bloomed eventually too.

if (client_version == PROTOCOL_VER1) {
msg_checksum += checksum(stream.getLength() - 1);
}
// msg_checksum += checksum(stream.getLength() - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

* io_service thread to avoid a concurrency nightmare.
*/
void ros_spin_timeout(const boost::system::error_code& error) {
ros_callback_queue_.callAvailable();
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the kernel of the change— periodically calling ROS callbacks on the ASIO thread, rather than from a separate one.

This is a long overdue change which will resolve some crashes when
USB serial devices return error states in the face or noise or other
interruptions.

As part of this change, the support for VER1 protocol (pre-Hydro)
has been dropped, to simplify the overall flow.
@mikepurvis
Copy link
Member Author

Note that this change is fully backward compatible— the API for "embedding" rosserial_server is unchanged, it's simply that running spin() separately is now superfluous.

@mikepurvis mikepurvis merged commit f58cf15 into jade-devel Jul 12, 2016
@mikeodr
Copy link
Contributor

mikeodr commented Jul 13, 2016

LGTM other than previous fix-it comments.

@mikepurvis mikepurvis deleted the explicit-session-lifecycle branch July 15, 2016 18: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.

2 participants