https://bugs.kde.org/show_bug.cgi?id=476747

Simon Redman <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Latest Commit|                            |https://invent.kde.org/netw
                   |                            |ork/kdeconnect-kde/-/commit
                   |                            |/31c755d22fd3cf3e7329877ad4
                   |                            |17ccbfc8ccedc1
         Resolution|---                         |FIXED

--- Comment #11 from Simon Redman <[email protected]> ---
Git commit 31c755d22fd3cf3e7329877ad417ccbfc8ccedc1 by Simon Redman, on behalf
of Bill Sterzenbach.
Committed on 23/03/2026 at 22:26.
Pushed by sredman into branch 'master'.

Tune TCP keepalive to 60s for dead connection detection

# Summary 

Override Linux kernel TCP keepalive defaults on LAN sockets to detect dead
connections in \~60s instead of \~7875s.

## Problem 

Qt's KeepAliveOption enables kernel-level TCP keepalive but uses Linux
defaults:

TCP_KEEPIDLE = 7200s (2 hours before first probe) TCP_KEEPINTVL = 75s (between
probes) TCP_KEEPCNT = 9 (failed probes before drop) Total: \~7875s (\~2.2
hours) to detect a dead connection When a phone silently disappears (e.g. WiFi
off, network change), isReachable() remains true for over two hours. During
this window, sends from the SMS app fail silently — no error, no notification,
the message just never arrives. The app's built-in disconnect handling never
engages because the kernel doesn't report the connection as dead.

### Fix 

Set per-socket keepalive parameters in configureSocket():

TCP_KEEPIDLE = 30s (idle before first probe) TCP_KEEPINTVL = 10s (between
probes) TCP_KEEPCNT = 3 (failed probes before drop) Total: \~60s to detect a
dead connection The 60s window is long enough to survive brief network
interruptions (WiFi handoffs, momentary signal loss) without triggering
unnecessary disconnects, while still detecting genuinely dead connections
quickly. Once the kernel reports the connection as dead, KDE Connect's existing
disconnect handling takes over normally.

Guarded by #ifdef TCP_KEEPIDLE so it compiles cleanly on platforms that don't
support these socket options.

Bandwidth cost is negligible: 3 tiny TCP ACK packets per minute per connection.

Developed with AI assistance (Claude Opus 4.6 Thinking via Windsurf). Code was
personally reviewed and tested by a human with a connected device. Also much
arguing with Claude took place. Things were said, digital feelings where hurt.
We're on a healing journey at this time. Please keep us in your thoughts.

M  +16   -0    core/backends/lan/lanlinkprovider.cpp

https://invent.kde.org/network/kdeconnect-kde/-/commit/31c755d22fd3cf3e7329877ad417ccbfc8ccedc1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to