diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-04 03:27:41 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-04 03:27:41 +0200 |
commit | 92d10abc1b66907f84b82d2d34552a90b852aa5f (patch) | |
tree | 8a90476f1ab39e133ff741ea2ad18010335b2b87 /runtime/nsd_ptcp.c | |
parent | b22990c6d359ffdedbf266672b8c875964b81d64 (diff) | |
parent | 4f742a8e32c43dc9b514ceaf80f4d17e697dfdf6 (diff) | |
download | rsyslog-92d10abc1b66907f84b82d2d34552a90b852aa5f.tar.gz rsyslog-92d10abc1b66907f84b82d2d34552a90b852aa5f.tar.xz rsyslog-92d10abc1b66907f84b82d2d34552a90b852aa5f.zip |
Merge branch 'master' into v5-devel
Conflicts:
ChangeLog
runtime/rsyslog.h
Diffstat (limited to 'runtime/nsd_ptcp.c')
-rw-r--r-- | runtime/nsd_ptcp.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c index cc531ca0..54ee0666 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) |