Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions backend/cmd/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

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

# UDP Configuration
# These settings control the UDP server's buffer sizes and performance characteristics
[udp]
ring_buffer_size = 64 # Size of the ring buffer for incoming packets (number of packets, not bytes)
packet_chan_size = 16 # Size of the channel buffer
keep_alive_check_interval_ms = 5 # How often the keep-alive checks last-received times (ms)
keep_alive_timeout_ms = 100 # Max time without packets from an IP before it is considered disconnected (ms)


# Logger Configuration
Expand Down
2 changes: 2 additions & 0 deletions backend/cmd/dev-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ keep_alive_ms = 0 # Keep-alive interval in milliseconds (0 to disab
[udp]
ring_buffer_size = 64 # Size of the ring buffer for incoming packets (number of packets, not bytes)
packet_chan_size = 16 # Size of the channel buffer
keep_alive_check_interval_ms = 5 # How often the keep-alive checks last-received times (ms)
keep_alive_timeout_ms = 100 # Max time without packets from an IP before it is considered disconnected (ms)

# Server Configuration
[server.ethernet-view]
Expand Down
21 changes: 20 additions & 1 deletion backend/cmd/setup_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,26 @@ func configureUDPServerTransport(

) {
trace.Info().Msg("Starting UDP server")
udpServer := udp.NewServer(adj.Info.Addresses[BACKEND], adj.Info.Ports[UDP], &trace.Logger, config.UDP.RingBufferSize, config.UDP.PacketChanSize)

onKeepAliveTimeout := func(ip string) {
transp.SendFault()
board, ok := transp.TargetFromIp(ip)
if !ok {
board = "unknown"
}
transp.ReportError(fmt.Errorf("UDP keep-alive timeout: no packets received from board %s (%s) for %dms, fault sent", board, ip, config.UDP.KeepAliveTimeoutMs))
}

udpServer := udp.NewServer(
adj.Info.Addresses[BACKEND],
adj.Info.Ports[UDP],
&trace.Logger,
config.UDP.RingBufferSize,
config.UDP.PacketChanSize,
time.Duration(config.UDP.KeepAliveCheckIntervalMs)*time.Millisecond,
time.Duration(config.UDP.KeepAliveTimeoutMs)*time.Millisecond,
onKeepAliveTimeout,
)
err := udpServer.Start()
if err != nil {
trace.Fatal().Err(err).Msg("failed to start UDP server: " + err.Error())
Expand Down
6 changes: 4 additions & 2 deletions backend/internal/config/config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ type TCP struct {
}

type UDP struct {
RingBufferSize int `toml:"ring_buffer_size"`
PacketChanSize int `toml:"packet_chan_size"`
RingBufferSize int `toml:"ring_buffer_size"`
PacketChanSize int `toml:"packet_chan_size"`
KeepAliveCheckIntervalMs int `toml:"keep_alive_check_interval_ms"`
KeepAliveTimeoutMs int `toml:"keep_alive_timeout_ms"`
}

type Logging struct {
Expand Down
291 changes: 0 additions & 291 deletions backend/pkg/transport/network/tcp/reconnection_test.go

This file was deleted.

Loading
Loading