SnapCap TCP Connection Reliability Improvements#2381
Open
miceno wants to merge 12 commits intoindilib:masterfrom
Open
SnapCap TCP Connection Reliability Improvements#2381miceno wants to merge 12 commits intoindilib:masterfrom
miceno wants to merge 12 commits intoindilib:masterfrom
Conversation
Contributor
|
Thanks. This would affect any INDI driver, not just SnapCap. What would lead to this exactly? WiFi/Network Controller drops the connection or what? |
Contributor
Author
|
The driver is for a home-made SnapCap dust cover. The cover is implemented using a ESP8266 and the connection is by WiFi. From time to time the ESP8266 disconnects from the network or reboots. When it reboots, or disconnects, the connection is lost forever, the driver does not try it again. If you have automated a session, the session will not succeed, since the cap will never open nor close when required. |
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.
SnapCap TCP Connection Reliability Improvements
Problem Statement
SnapCap communication can degrade when:
Without recovery logic, manual disconnect/reconnect is required from the client.
Proposed Design
The driver now uses a reconnect abstraction:
SnapCap::ReconnectInterfaceindrivers/auxiliary/snapcap.hSnapCapReconnectimplementation indrivers/auxiliary/snapcap.cppReconnect is non-blocking and driven from
TimerHit(), so command handlers do not sleep-loop while recovering.Configurable policy from INDI UI (
RECONNECT_POLICY)CONNECTION_TABas propertyRECONNECT_POLICY.FAILURES_BEFORE_RECONNECTshows as Max FailuresDELAY_MSshows as Base delay (ms)FAILURES_BEFORE_RECONNECT(MIN_FAILURES_BEFORE_RECONNECT..MAX_FAILURES_BEFORE_RECONNECT, default2)DELAY_MS(MIN_RECONNECT_DELAY_MS..MAX_RECONNECT_DELAY_SETTING_MS, default500)ISNewNumber()and persisted withsaveConfig(ReconnectNP).Exponential backoff with cap
computeReconnectDelayMs(attemptCount).DELAY_MS, doubles by attempt, capped byMAX_RECONNECT_DELAY_MS(4000 ms).2x,4x,8x, ... ofDELAY_MS(with cap).Future work
Use this same strategy for other components that communicate over TCP, like the
rolloffino.