summaryrefslogtreecommitdiffstats
path: root/tcpclt.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-14 16:57:49 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-14 19:45:26 +0200
commit935a9eef5770a4a298d1ccefab59e3863210fc68 (patch)
tree929fe1f70e7c648a1ca52d886f7b633869eb79e2 /tcpclt.c
parent9e81945a64fa25bb47348fe7eff502d7852045b5 (diff)
downloadrsyslog-935a9eef5770a4a298d1ccefab59e3863210fc68.zip
rsyslog-935a9eef5770a4a298d1ccefab59e3863210fc68.tar.gz
rsyslog-935a9eef5770a4a298d1ccefab59e3863210fc68.tar.xz
added tcp output rebinding option.
added tcp output rebinding option. needs some more testing and doc
Diffstat (limited to 'tcpclt.c')
-rw-r--r--tcpclt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tcpclt.c b/tcpclt.c
index c53f00f..617aaef 100644
--- a/tcpclt.c
+++ b/tcpclt.c
@@ -297,6 +297,12 @@ Send(tcpclt_t *pThis, void *pData, char *msg, size_t len)
CHKiRet(TCPSendBldFrame(pThis, &msg, &len, &bMsgMustBeFreed));
+ if(pThis->iRebindInterval > 0 && ++pThis->iNumMsgs == pThis->iRebindInterval) {
+ /* we need to rebind, and use the retry logic for this*/
+ CHKiRet(pThis->prepRetryFunc(pData)); /* try to recover */
+ pThis->iNumMsgs = 0;
+ }
+
while(!bDone) { /* loop is broken when send succeeds or error occurs */
CHKiRet(pThis->initFunc(pData));
iRet = pThis->sendFunc(pData, msg, len);
@@ -388,6 +394,13 @@ SetFraming(tcpclt_t *pThis, TCPFRAMINGMODE framing)
pThis->tcp_framing = framing;
RETiRet;
}
+static rsRetVal
+SetRebindInterval(tcpclt_t *pThis, int iRebindInterval)
+{
+ DEFiRet;
+ pThis->iRebindInterval = iRebindInterval;
+ RETiRet;
+}
/* Standard-Constructor
@@ -445,6 +458,7 @@ CODESTARTobjQueryInterface(tcpclt)
pIf->SetSendFrame = SetSendFrame;
pIf->SetSendPrepRetry = SetSendPrepRetry;
pIf->SetFraming = SetFraming;
+ pIf->SetRebindInterval = SetRebindInterval;
finalize_it:
ENDobjQueryInterface(tcpclt)