From 6feda0632367deaa9caf193e89b74f7affd45021 Mon Sep 17 00:00:00 2001 From: Bernhard Guillon Date: Tue, 7 Jul 2026 14:33:57 +0200 Subject: Add heartbeat ping/pong to detect disconnects Windows client sends ping every 10s. Linux server responds with pong. If write fails, client detects disconnect and reconnects. --- cmd_linux.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd_linux.go') diff --git a/cmd_linux.go b/cmd_linux.go index 5d5e10a..4239d1d 100644 --- a/cmd_linux.go +++ b/cmd_linux.go @@ -155,6 +155,13 @@ func handleClient(conn net.Conn, stack *GitignoreStack) { msg.Path, remoteManifest, *dryRun, ) } + + case "ping": + logDebug("ping from client") + pong := &ProtocolMessage{Type: "pong"} + pongData, _ := EncodeMessage(pong) + pongData = append(pongData, '\n') + conn.Write(pongData) } } -- cgit v1.2.3