summaryrefslogtreecommitdiff
path: root/runtime/nsd_ptcp.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2009-08-21 22:28:21 +0200
committerMichael Biebl <biebl@debian.org>2009-08-21 22:28:21 +0200
commit2299dddfa134ce3e55ee3a7fd2181f0e4ddff0bd (patch)
tree95aebee3d2f92366e9086e0f0dec069d9cbb71a0 /runtime/nsd_ptcp.c
parent62b1f9d1c05362d94d91048f2332339c5767381b (diff)
downloadrsyslog-2299dddfa134ce3e55ee3a7fd2181f0e4ddff0bd.tar.gz
Imported Upstream version 4.4.0upstream/4.4.0
Diffstat (limited to 'runtime/nsd_ptcp.c')
-rw-r--r--runtime/nsd_ptcp.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c
index cc531ca..54ee066 100644
--- a/runtime/nsd_ptcp.c
+++ b/runtime/nsd_ptcp.c
@@ -614,6 +614,34 @@ finalize_it:
}
+/* Enable KEEPALIVE handling on the socket.
+ * rgerhards, 2009-06-02
+ */
+static rsRetVal
+EnableKeepAlive(nsd_t *pNsd)
+{
+ nsd_ptcp_t *pThis = (nsd_ptcp_t*) pNsd;
+ int ret;
+ int optval;
+ socklen_t optlen;
+ DEFiRet;
+ ISOBJ_TYPE_assert(pThis, nsd_ptcp);
+
+ optval = 1;
+ optlen = sizeof(optval);
+ ret = setsockopt(pThis->sock, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen);
+ if(ret < 0) {
+ dbgprintf("EnableKeepAlive socket call returns error %d\n", ret);
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
+ dbgprintf("KEEPALIVE enabled for nsd %p\n", pThis);
+
+finalize_it:
+ RETiRet;
+}
+
+
/* open a connection to a remote host (server).
* rgerhards, 2008-03-19
*/
@@ -754,6 +782,7 @@ CODESTARTobjQueryInterface(nsd_ptcp)
pIf->GetRemoteHName = GetRemoteHName;
pIf->GetRemoteIP = GetRemoteIP;
pIf->CheckConnection = CheckConnection;
+ pIf->EnableKeepAlive = EnableKeepAlive;
finalize_it:
ENDobjQueryInterface(nsd_ptcp)