summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoman Rakus <rrakus@redhat.com>2013-06-28 15:17:38 +0200
committerRoman Rakus <rrakus@redhat.com>2013-07-01 11:30:49 +0200
commit9382852767bcd560fa14e9cdbbbc8764fdf4dd91 (patch)
tree6d3764fff0da7ca9faa68ac3d8e220be82e59bb4 /src
parent98e4b5dc9129d4f03e2ee9eae9aef2d7bd1009a0 (diff)
downloadopenlmi-providers-9382852767bcd560fa14e9cdbbbc8764fdf4dd91.tar.gz
openlmi-providers-9382852767bcd560fa14e9cdbbbc8764fdf4dd91.tar.xz
openlmi-providers-9382852767bcd560fa14e9cdbbbc8764fdf4dd91.zip
Indication manager: Do first poll for newly added filters
When some filter is added there was missing very first poll leading in loosing of first indication. Signed-off-by: Roman Rakus <rrakus@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/indmanager/ind_manager.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/indmanager/ind_manager.c b/src/indmanager/ind_manager.c
index e2fba79..d3a73e8 100644
--- a/src/indmanager/ind_manager.c
+++ b/src/indmanager/ind_manager.c
@@ -458,6 +458,30 @@ bool pair_enumeration(IMManager *manager, IMEnumerationPair *epair)
return true;
}
+// When the filter is added there is no enum pairs created
+// This function will generate pairs where they are missing
+bool first_poll(IMManager *manager, IMError *err)
+{
+ DEBUG("IM first poll called");
+ if (!manager) {
+ *err = IM_ERR_MANAGER;
+ return false;
+ }
+ if (!manager->enums) {
+ // Nothing to poll
+ return true;
+ }
+ IMEnumerationPair *epair = NULL;
+ for (epair = manager->enums->first; epair; epair = epair->next) {
+ if (epair->this_enum == NULL && epair->prev_enum == NULL) {
+ if (!pair_enumeration(manager, epair)) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
bool _im_poll(IMManager *manager, IMError *err)
{
DEBUG("IM poll called");
@@ -653,6 +677,13 @@ static void *manage(void *data)
DEBUG("manage thread waiting to indication start");
pthread_cond_wait(&_t_cond, &_t_mutex);
}
+
+ if (manager->polling) {
+ if (!first_poll(manager, &err)) {
+ pthread_mutex_unlock(&_t_mutex);
+ return (void *)err;
+ }
+ }
pthread_mutex_unlock(&_t_mutex);
DEBUG("manage thread calling watcher");