Skip to content

Commit ded7963

Browse files
Merge pull request #569 from Hyperloop-UPV/backend/revive-tcp
Backend: small fixes
2 parents 35cb38e + 69442e9 commit ded7963

7 files changed

Lines changed: 28 additions & 1526 deletions

File tree

backend/cmd/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
# Vehicle Configuration
1212
[vehicle]
13-
boards = ["BCU", "BMSL", "HVSCU", "HVSCU-Cabinet", "LCU", "PCU", "VCU", "BLCU"]
13+
boards = ["HVBMS","LCU", "PCU", "VCU", "BLCU"]
1414

1515
# ADJ (Architecture Description JSON) Configuration
1616
[adj]
@@ -28,7 +28,7 @@ backoff_min_ms = 100 # Minimum backoff duration in milliseconds
2828
backoff_max_ms = 5000 # Maximum backoff duration in milliseconds
2929
backoff_multiplier = 1.5 # Exponential backoff multiplier (e.g., 1.5 means each retry waits 1.5x longer)
3030
max_retries = 0 # Maximum retries before cycling (0 = infinite retries, recommended for persistent reconnection)
31-
connection_timeout_ms = 1000 # Connection timeout in milliseconds
31+
connection_timeout_ms = 3000 # Connection timeout in milliseconds
3232
keep_alive_ms = 1000 # Keep-alive interval in milliseconds
3333

3434
# UDP Configuration

backend/cmd/setup_transport.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ func configureUDPServerTransport(
140140

141141
) {
142142
trace.Info().Msg("Starting UDP server")
143+
144+
onKeepAliveTimeout := func(ip string) {
145+
transp.SendFault()
146+
board, ok := transp.TargetFromIp(ip)
147+
if !ok {
148+
board = "unknown"
149+
}
150+
transp.ReportError(fmt.Errorf("UDP keep-alive timeout: no packets received from board %s (%s) for %dms, fault sent", board, ip, config.UDP.KeepAliveTimeoutMs))
151+
}
152+
143153
udpServer := udp.NewServer(
144154
adj.Info.Addresses[BACKEND],
145155
adj.Info.Ports[UDP],
@@ -148,7 +158,7 @@ func configureUDPServerTransport(
148158
config.UDP.PacketChanSize,
149159
time.Duration(config.UDP.KeepAliveCheckIntervalMs)*time.Millisecond,
150160
time.Duration(config.UDP.KeepAliveTimeoutMs)*time.Millisecond,
151-
transp.SendFault,
161+
onKeepAliveTimeout,
152162
)
153163
err := udpServer.Start()
154164
if err != nil {

backend/pkg/transport/network/tcp/reconnection_test.go

Lines changed: 0 additions & 291 deletions
This file was deleted.

0 commit comments

Comments
 (0)