Fix blocking send while holding request mutex - #40
Merged
Conversation
Move send() outside request_mutex_ while preserving command ordering with send_mutex_. Also apply clang-tidy modernize fixes in client.cpp. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the libwaterlinked TCP client to avoid holding the request-tracking mutex while performing a potentially blocking socket send(), while still preserving per-command ordering via a new dedicated send mutex.
Changes:
- Serialize command transmission with a new
send_mutex_, and narrow the scope ofrequest_mutex_to only pending-request bookkeeping. - Apply clang-tidy modernization updates (
std::scoped_lock, designated initializers forCommandResponse). - Bump
libwaterlinkedpackage metadata (version and maintainer).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| libwaterlinked/src/client.cpp | Moves command sending out from request_mutex_ and modernizes locking/struct initialization. |
| libwaterlinked/include/libwaterlinked/client.hpp | Adds send_mutex_ to enforce send ordering without blocking request bookkeeping. |
| libwaterlinked/package.xml | Updates package version and maintainer metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wlkh
approved these changes
Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move send() outside request_mutex_ while preserving command ordering with send_mutex_. Also apply clang-tidy modernize fixes in client.cpp.
Changes Made
Changes to libwaterlinked client.cpp to resolve blocking issue.
Associated Issues
Resolves issue discussed in #32
Testing
Please provide a clear and concise description of the testing performed.