Skip to content

Commit 5eae9f6

Browse files
committed
Fix beacon TTL reaping too aggressively during reconnection
Increased beacon node TTL from 5 to 10 minutes so nodes survive registry outages without losing beacon registration. Also fixed a nil pointer dereference in handlePunchRequest when the requester is unknown (beacon at capacity).
1 parent 1eb1624 commit 5eae9f6

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

pkg/beacon/server.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ const maxRelayPayload = 65535
5959
const maxBeaconNodes = 100_000
6060

6161
// beaconNodeTTL is how long a node entry lives without a discover refresh.
62-
const beaconNodeTTL = 5 * time.Minute
62+
// Set to 10 minutes (well above the 60s heartbeat-driven re-discover interval)
63+
// so nodes survive brief registry outages without losing beacon registration.
64+
const beaconNodeTTL = 10 * time.Minute
6365

6466
func New() *Server {
6567
return NewWithPeers(0, nil)
@@ -267,6 +269,10 @@ func (s *Server) handlePunchRequest(data []byte, remote *net.UDPAddr) {
267269
slog.Warn("punch target not found", "target_id", targetID)
268270
return
269271
}
272+
if requesterNode == nil {
273+
slog.Warn("punch requester not found", "requester_id", requesterID)
274+
return
275+
}
270276

271277
targetAddr := targetNode.addr
272278
requesterAddr := requesterNode.addr

0 commit comments

Comments
 (0)