Revision: 167
Author:
sma...@gmail.com
Date: Wed Dec 26 15:49:29 2012
Log: Add an option to enable TCP keepalives on client connections as
recommended by the IF-MAP base spec.
http://code.google.com/p/omapd/source/detail?r=167
Modified:
/trunk/omapd.conf
/trunk/omapdconfig.cpp
/trunk/server.cpp
=======================================
--- /trunk/omapd.conf Tue Nov 6 14:54:00 2012
+++ /trunk/omapd.conf Wed Dec 26 15:49:29 2012
@@ -90,6 +90,12 @@
<!-- default is 180 seconds -->
<!-- use 0 to disable the timeout -->
<session_metadata_timeout>180</session_metadata_timeout>
+
+ <!-- send TCP keepalives to clients. -->
+ <!-- enable="yes" enables TCP keepalives on socket connections. The
+ keepalive values are based on system settings -->
+ <!-- default is enable="no" -->
+ <send_tcp_keepalives enable="no"/>
</service_configuration>
<!-- Define specific authorized clients
=======================================
--- /trunk/omapdconfig.cpp Tue Nov 6 14:54:00 2012
+++ /trunk/omapdconfig.cpp Wed Dec 26 15:49:29 2012
@@ -173,6 +173,7 @@
_omapdConfig.insert("allow_unauthenticated_clients", false);
_omapdConfig.insert("allow_arc_on_ssrc", false);
_omapdConfig.insert("session_metadata_timeout", 180);
+ _omapdConfig.insert("send_tcp_keepalives", false);
// Default authorization is DenyAll
var.setValue(OmapdConfig::authzOptions(0));
@@ -325,6 +326,12 @@
QString value = xmlReader.readElementText();
addConfigItem(xmlReader.name().toString(),
QVariant(value.toUInt()));
+ } else if (xmlReader.name()
== "send_tcp_keepalives") {
+ bool enable = false;
+ if (xmlReader.attributes().value("enable")
== "yes")
+ enable = true;
+ addConfigItem(xmlReader.name().toString(),
enable);
+
} else if (xmlReader.name()
== "ssl_configuration") {
bool enable = false;
if (xmlReader.attributes().value("enable")
== "yes")
=======================================
--- /trunk/server.cpp Tue Oct 30 13:09:45 2012
+++ /trunk/server.cpp Wed Dec 26 15:49:29 2012
@@ -59,6 +59,11 @@
{
ClientHandler *client = new ClientHandler(_mapGraph, this);
client->setSocketDescriptor(socketDescriptor);
+
+ if (_omapdConfig->valueFor("send_tcp_keepalives").toBool()) {
+ client->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
+ }
+
client->startServerEncryption();
QObject::connect(client, SIGNAL(disconnected()),