Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Implement TCP connections #16

Merged
merged 13 commits into from
Nov 3, 2023
Merged

Implement TCP connections #16

merged 13 commits into from
Nov 3, 2023

Conversation

jmaralo
Copy link
Member

@jmaralo jmaralo commented Oct 25, 2023

Implement the TCP logic. There are two main parts to it: the TCPSource and the TCPConn.

TCPSource exists because for each board we can either establish a connection as a server or as a client. The struct TCPClient is a TCPSource for single direct connections and the struct TCPServer for multiple connections. This allows to abstract the "establishing connection" from the "using connection logic". Sources run and notify when a connection is made through callbacks.

TCPClient retries to reconnect if the connection fails using an exponential backoff. Once the connection is created, TCPConn is in charge of notifying disconnections and external logic should handle calling again TCPClient.Run()

TCPServer creates a TCP listener and accepts connections specified on a list.

TCPConn allows to read and write from the connection, it also provides a callback to notify when the connection status changes (sends true when connected and false when disconnected).

@jmaralo jmaralo added this to the v1.0.0 milestone Oct 25, 2023
@jmaralo jmaralo self-assigned this Oct 25, 2023
@andresdlt03 andresdlt03 marked this pull request as ready for review October 25, 2023 21:05
@jmaralo jmaralo marked this pull request as draft October 27, 2023 10:54
@jmaralo jmaralo marked this pull request as ready for review November 2, 2023 14:22
@jmaralo jmaralo requested a review from andresdlt03 November 2, 2023 14:22
@jmaralo jmaralo merged commit 22f0f95 into develop Nov 3, 2023
2 checks passed
@jmaralo jmaralo deleted the features/tcp branch November 4, 2023 13:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants