NUT-Monitor: Add automatic reconnection mechanism for Py2Gtk2 as well as Py3Qt{5,6} variants#3530
NUT-Monitor: Add automatic reconnection mechanism for Py2Gtk2 as well as Py3Qt{5,6} variants#3530jimklimov wants to merge 7 commits into
Conversation
|
A ZIP file with standard source tarball and another tarball with pre-built docs for commit 5758874 is temporarily available: NUT-tarballs-PR-3530.zip. |
|
✅ Build nut 2.8.5.4929-master completed (commit acaf0b2929 by @jimklimov)
|
|
Seems to work. I found a host where Py2Gtk could still run (NetBSD 9.2), connected to a NUT server from NUT-Monitor, and stopped the server. Within a few seconds, the client status bar was cycling the reconnection messages every couple of seconds: and it was satisfied soon after I started the data server back: NOTE: The status bar message remains "Reconnected" even after a couple of hours, as opposed to "Connected..." seen initially. Double-checked that at least Py3Qt5 variant worked similarly at least once, more details in #3523. Kudos to @developersorli for the original work on Python3 versions, and IntelliJ Junie for porting it to Python2 :) |
- 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>
…stools#3509, networkupstools#3523] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…tion modeled after PR networkupstools#3523 for Python3 siblings [networkupstools#3509] Co-Authored-By: Programer <developer.sorli@gmail.com> Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ominally executable Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
… un-received chunk [networkupstools#3509] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…end() [networkupstools#3509] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ossible stall in reconnection attempts [networkupstools#3509] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
|
Rebased and updated to address reconnection issues seen with Py3 variants, logged in #3523. Per testing, reconnection now works for all variants, with Py3Qt* tested over both X11+SSH (with no system notification handler to talk to) and in a natively windowed environment (with two relevant notifications about loss and appearance of connection, no flood). |
|
✅ Build nut 2.8.5.4943-master completed (commit afb55116cb by @jimklimov)
|
|
✅ Build nut 2.8.5.4943-master completed (commit afb55116cb by @jimklimov) |



Replicate the solution from #3523; testing needed
Should help UI on antique platforms that can not for some reason be updated; in fact I currently struggle to find testbeds with GUI that would be so far behind ;)