[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:28:10 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=6926fca
The following commit has been merged in the master branch:
commit 6926fca59830a022f6f4454ff2f9d6653670f4ea
Author: Pramod Dematagoda <pmdematagoda at mykolab.ch>
Date: Sun Dec 28 20:49:05 2014 -0800
Adjust socket parameters to detect device disconnection faster.
REVIEW: 121711
---
core/backends/lan/lanlinkprovider.cpp | 39 +++++++++++++++++------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/core/backends/lan/lanlinkprovider.cpp b/core/backends/lan/lanlinkprovider.cpp
index 39d3037..4bd31d2 100644
--- a/core/backends/lan/lanlinkprovider.cpp
+++ b/core/backends/lan/lanlinkprovider.cpp
@@ -38,27 +38,26 @@
void LanLinkProvider::configureSocket(QTcpSocket* socket)
{
int fd = socket->socketDescriptor();
- char enableKeepAlive = 1;
- setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &enableKeepAlive, sizeof(enableKeepAlive));
-
-#ifdef TCP_KEEPIDLE
- int maxIdle = 60; /* seconds */
- setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &maxIdle, sizeof(maxIdle));
-#endif
-
-#ifdef TCP_KEEPCNT
- if (getprotobyname("TCP")) {
- int count = 3; // send up to 3 keepalive packets out, then disconnect if no response
- setsockopt(fd, getprotobyname("TCP")->p_proto, TCP_KEEPCNT, &count, sizeof(count));
- }
-#endif
-#ifdef TCP_KEEPINTVL
- if (getprotobyname("TCP")) {
- int interval = 5; // send a keepalive packet out every 2 seconds (after the 5 second idle period)
- setsockopt(fd, getprotobyname("TCP")->p_proto, TCP_KEEPINTVL, &interval, sizeof(interval));
- }
-#endif
+ socket->setSocketOption(QAbstractSocket::KeepAliveOption, QVariant(1));
+
+ #ifdef TCP_KEEPIDLE
+ // time to start sending keepalive packets (seconds)
+ int maxIdle = 10;
+ setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &maxIdle, sizeof(maxIdle));
+ #endif
+
+ #ifdef TCP_KEEPINTVL
+ // interval between keepalive packets after the initial period (seconds)
+ int interval = 5;
+ setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &interval, sizeof(interval));
+ #endif
+
+ #ifdef TCP_KEEPCNT
+ // number of missed keepalive packets before disconnecting
+ int count = 3;
+ setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, &count, sizeof(count));
+ #endif
}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list