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
Improve Connection handling & Logging, Power State handling #11
Merged
Conversation
This file contains 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
- WinNUT.vb: Added common logic for handling a disconnection from the UPS, as far as the application as a whole is concerned. This should hopefully fix a few bugs or at least add some stability.
- I shouldn't have put the Logger in the Globals module, IMO it belongs in the main client and passed as necessary to other objects. - Remove user data from client library project.
- Modified Socket parameters, hoping this will help with IPv6 support
- Socket ConnectionStatus is derived from Socket directly - Bring Logger object into Socket - Create_Socket is turned into a subroutine; utilizing Events and Exceptions for communication - Attempted to make AuthLogin failures non-critical - Removed ReConnect subroutine from UPS_Device - Additional bits of logging sprinkled everywhere - Tried implementing Connection event for WinNUT to prevent hanging main thread, needs work - No longer attempt to connect immediatly at start up - Breakout UPS connection login into a seperate subroutine - Tweak disconnection subroutine - Reconnect menu now disconnects and connects again - Uncomment part of prefs_changed, now disconnect and connect UPS again.
…or proper OOP - Disabled auto-connecting to UPS on first start since it locks the GUI thread on a slow connection - Cleaned up UPS_Connect subroutine for readability, improved log messages, and add a handler for lost_connection events - Cleaned up UPSDisconnect function: Handlers removed, modified to be reactive in the UI rather than controlling the backend - Disallowed changing config on the fly from external sources (a Nut_Socket object instead could be considered immutable, and must be destroyed if needing to change settings. Hopefully prevents unexpected bugs) - Add a dedicated disconnect subroutine to the Socket class. - Fixed underlying socket not being connected - Removed dedicated ConnectionStatus variable; not quite sure what its purpose was (might regret this...) - Made UPS_Device the dedicated object for handling connection monitoring logic (was competing with _Socket before)
- Disabled building installer in Debug mode - Disabled WatchDog functionality throughout program, since regular data updating acts as a watchdog in and of its self. - Modified Nut_Exception to carry the Nut_Exception_Value as a property - Slightly reduced some Logging spam, and added a whole lot more. Socket: - Reorganized some functions/subroutines - Removed some fatal exceptions when a bad authentication occurs, since basic operations can still occur. - Removed exception handling from Query_Data so that exceptions are handled further up the stack. UPS_Device: - Connection events provide the UPS_Device as sender - Data polling is now handled inside the class rather than in the Form, and the Form must access the data from the UPS_Device object rather than getting its own copy. - Added Disconnect subroutine to handle shutting down a connection, from the UPS_Device. - Added subroutine to handle NUT exceptions thrown from the socket. Not sure what to do with these yet. WinNUT: - Relocated data updating responsibility to UPS_Device - Any attempts to disconnect now go through the UPS_Device - Created a new subroutine UPSReady that fires when the UPS indicated it's ready to start receiving data.
Updating changelog and preparing pre-release upload
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.
Focus on improving the handling of NUT connections, entering and exiting OS power states, and logging throughout. Targeting issue #4 .