Skip to content

TCP retry on establishing connection#2390

Open
miceno wants to merge 12 commits into
indilib:masterfrom
miceno:feat/tcp-retry
Open

TCP retry on establishing connection#2390
miceno wants to merge 12 commits into
indilib:masterfrom
miceno:feat/tcp-retry

Conversation

@miceno

@miceno miceno commented May 10, 2026

Copy link
Copy Markdown
Contributor

This is a PR to refactor the Connection::TCP class to allow reconnect in case of network failures. It implements exponential backoff delay, with suitable limits to prevent blocking the driver.

It adds two config params to the Connection:

  • Number of retries.
  • Base backoff delay.

@knro

knro commented May 15, 2026

Copy link
Copy Markdown
Contributor

Thank you. How would a connection loss be detected in this case? It appears this only applies to the initial handshake?

@miceno

miceno commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

Yes, it is only for the initial connection. There is no method on the TCP object to read data, so it is not possible as of now that the TCP class will reconnect in case a read/write error on the network occurs. Network operations are delegated to clients of the class, for example, Dome interface creates a TCP connection but it does not read nor write data to the port, it is an implementation like Rolloffino class that sends and receives the data.

I feel we can add status to the TCP connection, by adding a sort of keep-alive, but it requires modifying the interface, not sure how the approach should be, but I have a look at it if you consider it the right way.

On the other hand there is also the approach of adding the reconnect logic to the client class. In this case, it will be like:

  1. detect read or write operation didn't succeed due to a network disconnect.
  2. disconnect
  3. reconnect
  4. try again
    I feel part of this logic can be encapsulated in the TCP class too.

Not sure about the right approach.

@knro knro added this to the 2.4.0 milestone May 17, 2026
@miceno miceno changed the title TCP retry on connection lost TCP retry on establishing connection May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants