diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-09 10:07:23 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2011-05-09 10:07:23 +0200 |
commit | 6625a8790d3e89b3ecc0612cf08fc917b9631398 (patch) | |
tree | 2b03cced8188a1e333936063469f827f5e94f90b /tcpsrv.c | |
parent | 9430aa0d3a982d7759bb5d7db1be9b64064550ec (diff) | |
download | rsyslog-6625a8790d3e89b3ecc0612cf08fc917b9631398.tar.gz rsyslog-6625a8790d3e89b3ecc0612cf08fc917b9631398.tar.bz2 rsyslog-6625a8790d3e89b3ecc0612cf08fc917b9631398.zip |
added capability for imtcp to activate keep-alive packets
at the socket layer.
reference: http://kb.monitorware.com/post20791.html
Diffstat (limited to 'tcpsrv.c')
-rw-r--r-- | tcpsrv.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -396,6 +396,10 @@ SessAccept(tcpsrv_t *pThis, tcpLstnPortList_t *pLstnInfo, tcps_sess_t **ppSess, ABORT_FINALIZE(RS_RET_MAX_SESS_REACHED); } + if(pThis->bUseKeepAlive) { + CHKiRet(netstrm.EnableKeepAlive(pNewStrm)); + } + /* we found a free spot and can construct our session object */ CHKiRet(tcps_sess.Construct(&pSess)); CHKiRet(tcps_sess.SetTcpsrv(pSess, pThis)); @@ -864,6 +868,15 @@ SetUsrP(tcpsrv_t *pThis, void *pUsr) } static rsRetVal +SetKeepAlive(tcpsrv_t *pThis, int iVal) +{ + DEFiRet; + dbgprintf("tcpsrv: keep-alive set to %d\n", iVal); + pThis->bUseKeepAlive = iVal; + RETiRet; +} + +static rsRetVal SetOnMsgReceive(tcpsrv_t *pThis, rsRetVal (*OnMsgReceive)(tcps_sess_t*, uchar*, int)) { DEFiRet; @@ -1042,6 +1055,7 @@ CODESTARTobjQueryInterface(tcpsrv) pIf->create_tcp_socket = create_tcp_socket; pIf->Run = Run; + pIf->SetKeepAlive = SetKeepAlive; pIf->SetUsrP = SetUsrP; pIf->SetInputName = SetInputName; pIf->SetAddtlFrameDelim = SetAddtlFrameDelim; |