RDKEMW-21048: Mutex to access m_lastConnectedSSID in NMPlugin (#339) - #344
Merged
Conversation
* RDKEMW-21048: Use mutex to access m_lastConnectedSSID in NetworkManager Plugin Reason for change: Use mutex to access m_lastConnectedSSID in NetworkManager Plugin. Priority: P2 Test Procedure: Refer ticket Risks: Low Signed-off-by: Mehavarshni_Palaniswamy@comcast.com * Updated the logging and removed TAB Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com> --------- Signed-off-by: Mehavarshni_Palaniswamy@comcast.com Signed-off-by: Karunakaran A <karunakaran_amirthalingam@cable.comcast.com>
| wifi->activateKnownConnection(nmUtils::wlanIface(), _instance->m_lastConnectedSSID); | ||
| const string lastConnectedSSID = _instance->getLastConnectedSSID(); | ||
| NMLOG_INFO("Activating connection '%s' ...", lastConnectedSSID.c_str()); | ||
| wifi->activateKnownConnection(nmUtils::wlanIface(), lastConnectedSSID); |
| if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), _instance->m_lastConnectedSSID)) | ||
| const string lastConnectedSSID = _instance->getLastConnectedSSID(); | ||
| NMLOG_WARNING("ssid is empty activating last connected ssid (%s) !", lastConnectedSSID.c_str()); | ||
| if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), lastConnectedSSID)) |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a mutex-protected accessor API for m_lastConnectedSSID in the NetworkManager plugin to avoid concurrent access issues, and updates callers to use the new getters/setters.
Changes:
- Added
setLastConnectedSSID()/getLastConnectedSSID()with a dedicated mutex inNetworkManagerImplementation. - Updated WiFi monitoring and deep-sleep reconnect paths to use the new accessors.
- Updated GNOME proxy/client code to use
getLastConnectedSSID()and improved related logging.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| plugin/NetworkManagerImplementation.h | Adds mutex + getter/setter for last connected SSID. |
| plugin/NetworkManagerImplementation.cpp | Replaces direct member access with the new SSID accessor API. |
| plugin/gnome/NetworkManagerGnomeProxy.cpp | Switches reconnection/activation logic to use getLastConnectedSSID() and updates logs. |
| plugin/gnome/gdbus/NetworkManagerGdbusProxy.cpp | Uses getLastConnectedSSID() for empty-SSID fallback activation. |
| plugin/gnome/gdbus/NetworkManagerGdbusClient.cpp | Uses getLastConnectedSSID() for auto-reconnect when enabling WiFi. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
816
to
+820
| if(ssid.ssid.empty()) | ||
| { | ||
| NMLOG_WARNING("ssid is empty activating last connected ssid !"); | ||
| if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), _instance->m_lastConnectedSSID)) | ||
| const string lastConnectedSSID = _instance->getLastConnectedSSID(); | ||
| NMLOG_WARNING("ssid is empty activating last connected ssid (%s) !", lastConnectedSSID.c_str()); | ||
| if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), lastConnectedSSID)) |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Reason for change: Use mutex to access m_lastConnectedSSID in NetworkManager Plugin.
Priority: P2
Test Procedure: Refer ticket
Risks: Low
Signed-off-by: Mehavarshni_Palaniswamy@comcast.com
Signed-off-by: Mehavarshni_Palaniswamy@comcast.com