NUT-Monitor: Add automatic reconnection mechanism for Qt5 and Qt6#3523
Open
developersorli wants to merge 1 commit into
Open
NUT-Monitor: Add automatic reconnection mechanism for Qt5 and Qt6#3523developersorli wants to merge 1 commit into
developersorli wants to merge 1 commit into
Conversation
- Add automatic reconnection when connection to NUT server is lost - Implement proper teardown of old PyNUTClient instances - Use specific exceptions (socket.error, ConnectionError, EOFError, OSError, PyNUT.PyNUTError) - Prevent multiple simultaneous reconnection attempts - Add 'was_online' flag to track connection state changes - Tested and confirmed working on both Qt5 and Qt6 Closes: networkupstools#3509 Signed-off-by: Programer <developer.sorli@gmail.com>
|
A ZIP file with standard source tarball and another tarball with pre-built docs for commit 1d157f9 is temporarily available: NUT-tarballs-PR-3523.zip. |
|
✅ Build nut 2.8.5.4914-master completed (commit 572b34b736 by @developersorli)
|
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.
Summary
This PR adds an automatic reconnection mechanism to NUT-Monitor-py3qt5 and NUT-Monitor-py3qt6. When the connection to the NUT server is lost (e.g., after system suspend/resume, network interruption, or NUT server restart), the client will automatically attempt to reconnect.
Changes
Reconnection logic in
gui_updater.__update():New
__attempt_reconnect()method:__reconnect_attemptedflag - prevents multiple simultaneous attemptsProper exception handling:
socket.error- network/socket errorsConnectionError- Python 3 built-in connection errorsEOFError- end of file / connection closedOSError- operating system errorsPyNUT.PyNUTError- NUT protocol errorsProper teardown of old connection handler:
was_onlineflag - tracks connection state changesTesting
Qt5: ✅ Fully tested and confirmed working
Qt6: ✅ Fully tested and confirmed working
Files Modified
scripts/python/app/NUT-Monitor-py3qt5.inscripts/python/app/NUT-Monitor-py3qt6.inRelated Issues
Closes #3509
Notes for Reviewers
PyNUTClientinstance is properly cleaned up before reconnection