Skip to content

Conversation

@gbakeman
Copy link
Contributor

@gbakeman gbakeman commented Nov 16, 2025

Attempting to troubleshoot lost connection problem in #223. This led to some significant changes in the socket communication code.

Enums: Removed noresponse enum, replaced with empty and unrecognized.

Socket:

  • Modified Disconnect sub to have more concise parameter, remove unnecessary stream disposal
  • Restructuring of core Query_Data subroutine. Moved or eliminated variable initialization, early sanity check for connection status, removed redundant newline in stream write, process response using .NET functions, move Enum parsing inline to subroutine, early check for null/empty response, distinct handling of good vs. bad results
  • Removed unused Watchdog code (essentially became null/empty case in Query subroutine)
  • Removed exception from Socket_Broken parameter

UPS:

  • Stop variable update loop from calling Socket_Broken() (prevents duplicate triggers, the other being in Socket)
  • In multi-variable get subroutine, only recurse on VARNOTSUPPORTED or STALE errors, everything else should be thrown.

Also includes a small bugfix that makes the connection menu command buttons sync their state when the connection is lost.

Enums: Removed noresponse enum, replaced with empty and unrecognized.
Socket:
- Modified Disconnect sub to have more concise parameter, remove unnecessary stream disposal
- Restructuring of core Query_Data subroutine. Moved or eliminated variable initialization, early sanity check for connection status, removed redundant newline in stream write, process response using .NET functions, move Enum parsing inline to subroutine, early check for null/empty response, distinct handling of good vs. bad results
- Removed unused Watchdog code (essentially became null/empty case in Query subroutine)
- Removed exception from Socket_Broken parameter
UPS:
- Stop variable update loop from calling Socket_Broken()
- In multi-variable get subroutine, only recurse on VARNOTSUPPORTED or STALE errors, everything else should be thrown.
@gbakeman gbakeman added this to the 2.3 Stable Release milestone Nov 16, 2025
@gbakeman gbakeman self-assigned this Nov 16, 2025
@gbakeman gbakeman added the enhancement New feature or request label Nov 16, 2025
@gbakeman gbakeman linked an issue Nov 16, 2025 that may be closed by this pull request
@gbakeman gbakeman added the bug Something isn't working label Nov 16, 2025
Main menu state was not being updated in a lost connection event handler.
@yoyoma2
Copy link

yoyoma2 commented Nov 17, 2025

I tried the debug build and can't reproduce the problem. 👏 No time to study the changes but what you said above makes very good sense. The socket stuff is handled in the socket layer and the UPS stuff does its own layer's thing and no longer goes full steam ahead except for the minor errors. Seems like a much improved/robust code structure. 🎉

@gbakeman gbakeman merged commit 98c0237 into dev-2.3 Nov 17, 2025
1 check passed
@gbakeman gbakeman deleted the 223-lost-con branch November 17, 2025 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not detecting lost connection in certain circumstances

3 participants