summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-23 12:05:53 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-23 12:05:53 +0000
commite88a15836ae698e3296bcd08acb5c6b1f24572a5 (patch)
treead2213fa219274cb44998a32d2785b661d576ce7 /plugins
parent102b640997ed1f3e9f660ab8f07b75155bd65ed7 (diff)
downloadrsyslog-e88a15836ae698e3296bcd08acb5c6b1f24572a5.tar.gz
rsyslog-e88a15836ae698e3296bcd08acb5c6b1f24572a5.tar.xz
rsyslog-e88a15836ae698e3296bcd08acb5c6b1f24572a5.zip
enabled relp session recovery
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omrelp/omrelp.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c
index b8a859fb..8240c118 100644
--- a/plugins/omrelp/omrelp.c
+++ b/plugins/omrelp/omrelp.c
@@ -56,6 +56,7 @@ typedef struct _instanceData {
char f_hname[MAXHOSTNAMELEN+1];
int compressionLevel; /* 0 - no compression, else level for zlib */
char *port;
+ int bInitialConnect; /* is this the initial connection request of our module? (0-no, 1-yes) */
int bIsConnected; /* currently connected to server? 0 - no, 1 - yes */
relpClt_t *pRelpClt; /* relp client for this instance */
} instanceData;
@@ -77,6 +78,7 @@ static char *getRelpPt(instanceData *pData)
BEGINcreateInstance
CODESTARTcreateInstance
+ pData->bInitialConnect = 1;
ENDcreateInstance
@@ -112,11 +114,19 @@ static rsRetVal doConnect(instanceData *pData)
{
DEFiRet;
- iRet = relpCltConnect(pData->pRelpClt, family, (uchar*) pData->port, (uchar*) pData->f_hname);
- pData->bIsConnected = (iRet == RELP_RET_OK) ? 1 : 0;
+ if(pData->bInitialConnect) {
+ iRet = relpCltConnect(pData->pRelpClt, family, (uchar*) pData->port, (uchar*) pData->f_hname);
+ pData->bInitialConnect = 0;
+ } else {
+ iRet = relpCltReconnect(pData->pRelpClt);
+ }
- if(iRet != RELP_RET_OK)
+ if(iRet == RELP_RET_OK) {
+ pData->bIsConnected = 1;
+ } else {
+ pData->bIsConnected = 0;
iRet = RS_RET_SUSPENDED;
+ }
RETiRet;
}