Initially CLM handle is set to 0. When CLM handle is initialized,
it can be initialized again only when saClmDispatch returns 
SA_AIS_ERR_BAD_HANDLE.
This will prevent coredumps with initialized CLM handle
caused with MDS UP message for AMF and CLM services.
---
 src/imm/immnd/immnd_clm.c  | 7 +++++++
 src/imm/immnd/immnd_main.c | 8 +++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/imm/immnd/immnd_clm.c b/src/imm/immnd/immnd_clm.c
index 4019439..beae739 100644
--- a/src/imm/immnd/immnd_clm.c
+++ b/src/imm/immnd/immnd_clm.c
@@ -199,6 +199,11 @@ void *immnd_clm_init_thread(void *cb)
 {
        TRACE_ENTER();
 
+       if(immnd_cb->clm_hdl) {
+               TRACE("CLM handle has already been initialized.");
+               goto done;
+       }
+
        SaAisErrorT rc =
            saClmInitialize_4(&immnd_cb->clm_hdl, &clm_callbacks, &clmVersion);
        while ((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT) ||
@@ -228,6 +233,8 @@ void *immnd_clm_init_thread(void *cb)
                exit(EXIT_FAILURE);
        }
        TRACE("CLM Initialization SUCCESS......");
+
+done:
        TRACE_LEAVE();
        return NULL;
 }
diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c
index bca8f80..0f8364d 100644
--- a/src/imm/immnd/immnd_main.c
+++ b/src/imm/immnd/immnd_main.c
@@ -423,11 +423,12 @@ int main(int argc, char *argv[])
                        }
 
                        if (fds[FD_CLM_INIT].revents & POLLIN) {
-                               osafassert(!immnd_cb->clm_hdl);
-                               TRACE("Initalize CLM ");
                                ncs_sel_obj_rmv_ind(&immnd_cb->clm_init_sel_obj,
                                                    true, true);
-                               immnd_init_with_clm();
+                               if(!immnd_cb->clm_hdl) {
+                                       TRACE("Initalize CLM ");
+                                       immnd_init_with_clm();
+                               }
                                nfds = 5;
                        }
 
@@ -445,6 +446,7 @@ int main(int argc, char *argv[])
                                                    immnd_cb->clm_hdl);
                                                immnd_clm_node_cleanup(
                                                    immnd_cb);
+                                               immnd_cb->clm_hdl = 0;
                                                immnd_cb->clmSelectionObject =
                                                    -1;
                                                immnd_init_with_clm();
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to