Skip to content

Commit 031f1c0

Browse files
committed
Add inactivity ping
1 parent 8afca6c commit 031f1c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tailnet/conn.go

+3
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ func (c *Conn) UpdateNodes(nodes []*Node) error {
302302
for _, peer := range c.netMap.Peers {
303303
if peerStatus, ok := status.Peer[peer.Key]; ok {
304304
// Clear out inactive connections!
305+
// If the connection hasn't been written to in a while, we manually
306+
// send a ping to ensure it's still alive.
305307
if !peerStatus.Active {
306308
continue
307309
}
@@ -318,6 +320,7 @@ func (c *Conn) UpdateNodes(nodes []*Node) error {
318320
Endpoints: node.Endpoints,
319321
DERP: fmt.Sprintf("%s:%d", tailcfg.DerpMagicIP, node.PreferredDERP),
320322
Hostinfo: hostinfo.New().View(),
323+
KeepAlive: true,
321324
}
322325
}
323326
c.netMap.Peers = make([]*tailcfg.Node, 0, len(peerMap))

0 commit comments

Comments
 (0)