summaryrefslogtreecommitdiffstats
path: root/plugins/ommongodb/ommongodb.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-11-13 13:15:15 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-11-13 13:15:15 +0100
commitdc760e8c672c2c896bc0d001fa1f7d9e02fe111c (patch)
tree89609f09d667ab7db2f60139eb59524458a57f60 /plugins/ommongodb/ommongodb.c
parent23278699e35173f46effda964fd80b8f868e8b3e (diff)
parent45a4134a8b5c9111398be3458bd27b4aa2f0e5c2 (diff)
downloadrsyslog-dc760e8c672c2c896bc0d001fa1f7d9e02fe111c.tar.gz
rsyslog-dc760e8c672c2c896bc0d001fa1f7d9e02fe111c.tar.bz2
rsyslog-dc760e8c672c2c896bc0d001fa1f7d9e02fe111c.zip
Merge branch 'master-ruleeng' into master-ruleeng-simd
Diffstat (limited to 'plugins/ommongodb/ommongodb.c')
-rw-r--r--plugins/ommongodb/ommongodb.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/plugins/ommongodb/ommongodb.c b/plugins/ommongodb/ommongodb.c
index af1f5a37..09f19768 100644
--- a/plugins/ommongodb/ommongodb.c
+++ b/plugins/ommongodb/ommongodb.c
@@ -4,7 +4,7 @@
* mongodb C interface is crap. Obtain the library here:
* https://github.com/algernon/libmongo-client
*
- * Copyright 2007-2012 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2007-2013 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@@ -71,6 +71,10 @@ typedef struct _instanceData {
int bErrMsgPermitted; /* only one errmsg permitted per connection */
} instanceData;
+typedef struct wrkrInstanceData {
+ instanceData *pData;
+} wrkrInstanceData_t;
+
/* tables for interfacing with the v6 config system */
/* action (instance) parameters */
@@ -89,10 +93,16 @@ static struct cnfparamblk actpblk =
actpdescr
};
+static pthread_mutex_t mutDoAct = PTHREAD_MUTEX_INITIALIZER;
+
BEGINcreateInstance
CODESTARTcreateInstance
ENDcreateInstance
+BEGINcreateWrkrInstance
+CODESTARTcreateWrkrInstance
+ENDcreateWrkrInstance
+
BEGINisCompatibleWithFeature
CODESTARTisCompatibleWithFeature
/* use this to specify if select features are supported by this
@@ -126,6 +136,10 @@ CODESTARTfreeInstance
free(pData->tplName);
ENDfreeInstance
+BEGINfreeWrkrInstance
+CODESTARTfreeWrkrInstance
+ENDfreeWrkrInstance
+
BEGINdbgPrintInstInfo
CODESTARTdbgPrintInstInfo
@@ -422,14 +436,17 @@ error:
BEGINtryResume
CODESTARTtryResume
- if(pData->conn == NULL) {
- iRet = initMongoDB(pData, 1);
+ if(pWrkrData->pData->conn == NULL) {
+ iRet = initMongoDB(pWrkrData->pData, 1);
}
ENDtryResume
BEGINdoAction
bson *doc = NULL;
+ instanceData *pData;
CODESTARTdoAction
+ pthread_mutex_lock(&mutDoAct);
+ pData = pWrkrData->pData;
/* see if we are ready to proceed */
if(pData->conn == NULL) {
CHKiRet(initMongoDB(pData, 0));
@@ -454,6 +471,7 @@ CODESTARTdoAction
}
finalize_it:
+ pthread_mutex_unlock(&mutDoAct);
if(doc != NULL)
bson_free(doc);
ENDdoAction
@@ -560,6 +578,7 @@ ENDmodExit
BEGINqueryEtryPt
CODESTARTqueryEtryPt
CODEqueryEtryPt_STD_OMOD_QUERIES
+CODEqueryEtryPt_STD_OMOD8_QUERIES
CODEqueryEtryPt_STD_CONF2_OMOD_QUERIES
ENDqueryEtryPt