Bug 442790

Summary: kdeconnect wont reconnect with pc after sleep until main window on pc is opened
Product: [Applications] kdeconnect Reporter: daf <daf.public>
Component: windows-applicationAssignee: brute4s99 <piyushaggarwal002>
Status: RESOLVED FIXED    
Severity: normal CC: tsmariomaniac, valdikss
Priority: NOR    
Version First Reported In: 0.8   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description daf 2021-09-21 22:29:18 UTC
SUMMARY

After resuming the PC from sleep the application will not reconnect unless the interface on PC is opened and the paired phone is clicked.


STEPS TO REPRODUCE
1. Put the computer to sleep for a ~1h
2. Resume the computer to sleep
3. Check KDE Connect status

OBSERVED RESULT
The phone wont show as connected. Opening the kde connect application on the phone by itself wont reconnect, opening the main window on PC and clicking the phone icon will re-establish connection.

EXPECTED RESULT
KDE Connect automatedly re-establish connection without user interaction.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 daf 2021-09-21 22:39:04 UTC
Forgot to add the version details:

SOFTWARE/OS VERSIONS
Windows: Windows 10.0.19043 (21H1)
Windows App Version: 0.0.878.0 (windows store version)
Android: 10 (lineage 17.1, build: 10 QQ3A, 200805.001) 
Android App Version: 1.17.0 (not battery optimized)
Comment 2 valdikss 2022-09-17 14:16:22 UTC
*** Bug 451597 has been marked as a duplicate of this bug. ***
Comment 3 Bug Janitor Service 2022-09-17 14:17:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/497
Comment 4 valdikss 2022-09-17 14:19:32 UTC
I believe that https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/497 should fix the issue. I'm not completely sure, but several hour testing with this patch did not trigger this behavior.
Comment 5 Albert Vaca Cintora 2023-03-04 13:07:07 UTC
Git commit bd796836c50bb8293ff6422d0bf24a34cac9c8ba by Albert Vaca Cintora, on behalf of ValdikSS ValdikSS.
Committed on 04/03/2023 at 13:06.
Pushed by albertvaka into branch 'master'.

Enable socket Keep-Alive on Windows

Windows does not use setsockopt for keep-alive configuration,
requiring WSAIoctl call.

https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals
Related: bug 451597

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

https://invent.kde.org/network/kdeconnect-kde/commit/bd796836c50bb8293ff6422d0bf24a34cac9c8ba