Ack from me.

/AndersBj 

-----Original Message-----
From: Hans Feldt 
Sent: den 29 augusti 2014 13:01
To: [email protected]; Anders Björnerstedt; [email protected]
Cc: [email protected]
Subject: [PATCH 2 of 2] imma: always reconnect to auth-server at immnd up 
[#1024]

 osaf/libs/agents/saf/imma/imma_init.c |  10 ----------  
osaf/libs/agents/saf/imma/imma_mds.c  |  13 +++++++++++++
 2 files changed, 13 insertions(+), 10 deletions(-)


After immnd restart the IMM interface no longer worked.

Reason was that the client was not re-connected and its MDS dest registered in 
the server.

Now registration is always done after having received the MDS UP event.

A missing lock/unlock was added in imma_process_stale_clients. This could 
potentially have caused inconsistency in the patricia tree since it could be 
accessed by two threads at the same time.

diff --git a/osaf/libs/agents/saf/imma/imma_init.c 
b/osaf/libs/agents/saf/imma/imma_init.c
--- a/osaf/libs/agents/saf/imma/imma_init.c
+++ b/osaf/libs/agents/saf/imma/imma_init.c
@@ -24,14 +24,12 @@
 ******************************************************************************/
 
 #define _GNU_SOURCE
-#include <configmake.h>
 #include <string.h>
 
 #include "imma.h"
 #include "osaf_poll.h"
 #include "osaf_extended_name.h"
 #include "saAis.h"
-#include "mds_dl_api.h"
 
 /*****************************************************************************
  global data used by IMMA
@@ -166,14 +164,6 @@ static uint32_t imma_create(NCSMDS_SVC_I
        imma_sync_with_immnd(cb); /* Needed to prevent endless TRY_AGAIN loop
                                                                 for first 
client. */
 
-       /* connect and register MDS dest with auth server in immnd */
-       const char *name = PKGLOCALSTATEDIR "/immnd.sock";
-       int status = mds_auth_server_connect(name, cb->imma_mds_adest, 10000);
-       if (status != NCSCC_RC_SUCCESS) {
-               TRACE_4("mds_auth_server_connect failed %u", status);
-               return NCSCC_RC_FAILURE;
-       }
-
        /* EDU initialisation ABT: Dont exactly know why we need this but... */
        if (m_NCS_EDU_HDL_INIT(&cb->edu_hdl) != NCSCC_RC_SUCCESS) {
                TRACE_3("Failed to initialize EDU handle"); diff --git 
a/osaf/libs/agents/saf/imma/imma_mds.c b/osaf/libs/agents/saf/imma/imma_mds.c
--- a/osaf/libs/agents/saf/imma/imma_mds.c
+++ b/osaf/libs/agents/saf/imma/imma_mds.c
@@ -23,8 +23,13 @@
 
 *****************************************************************************/
 
+#include <configmake.h>
+
 #include "imma.h"
 #include "ncs_util.h"
+#include "mds_dl_api.h"
+
+static const char *sockname = PKGLOCALSTATEDIR "/immnd.sock";
 
 static uint32_t imma_mds_enc_flat(IMMA_CB *cb, MDS_CALLBACK_ENC_FLAT_INFO 
*info);  static uint32_t imma_mds_dec_flat(IMMA_CB *cb, 
MDS_CALLBACK_DEC_FLAT_INFO *info); @@ -417,6 +422,14 @@ static uint32_t 
imma_mds_svc_evt(IMMA_CB
                        
m_NCS_LOCK(&cb->immnd_sync_lock,NCS_LOCK_WRITE);/*special sync lock*/
                        cb->is_immnd_up = true;
                        cb->immnd_mds_dest = svc_evt->i_dest;
+
+                       /* (Re-)connect and register our MDS dest with auth 
server in immnd */
+                       if (mds_auth_server_connect(sockname,
+                                       cb->imma_mds_adest, 10000) != 
NCSCC_RC_SUCCESS) {
+                               /* server UP indication yet this does not 
work... */
+                               LOG_WA("%s: mds_auth_server_connect failed", 
__FUNCTION__);
+                       }
+
                        if (cb->immnd_sync_awaited == true)
                                m_NCS_SEL_OBJ_IND(&cb->immnd_sync_sel);
                        
m_NCS_UNLOCK(&cb->immnd_sync_lock,NCS_LOCK_WRITE);/*special sync lock*/

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to