Usually, when I find myself in a situation where there is an error case that in theory could happen but I cant figure out if/when it will happen, which also should mean that it is rare, then instead of writing any elaborate code to deal with it, I either osafassert (which will log an error and assert) or I wxplicitly log an error and exit.
/AndersBj Hans Feldt wrote: > So this patch can/could have been split into two. The is_immnd_up setting > moved is a separate change done on speculation and not verified to improve > anything. > Do you want me to split the patch? > > Plus there might an additional issue to look as Anders and I discussed. > Adding logic to cater for when mds_auth_server_connect() fails and somehow > propagate that back to the client. This error has not happened yet so I don't > know what could cause it. How do I proceed with this? > > /Hans > > >> -----Original Message----- >> From: Hans Feldt [mailto:osafde...@gmail.com] >> Sent: den 10 september 2014 11:16 >> To: mahesh.va...@oracle.com; Anders Björnerstedt >> Cc: opensaf-devel@lists.sourceforge.net >> Subject: [devel] [PATCH 2 of 2] imma: use mds_auth_server_disconnect [#1050] >> >> osaf/libs/agents/saf/imma/imma.h | 1 + >> osaf/libs/agents/saf/imma/imma_init.c | 6 ++++++ >> osaf/libs/agents/saf/imma/imma_mds.c | 7 ++++--- >> 3 files changed, 11 insertions(+), 3 deletions(-) >> >> >> diff --git a/osaf/libs/agents/saf/imma/imma.h >> b/osaf/libs/agents/saf/imma/imma.h >> --- a/osaf/libs/agents/saf/imma/imma.h >> +++ b/osaf/libs/agents/saf/imma/imma.h >> @@ -36,6 +36,7 @@ >> #include "imma_mds.h" >> >> extern IMMA_CB imma_cb; >> +extern const char *imma_sockname; >> >> unsigned int imma_shutdown(NCSMDS_SVC_ID sv_id); >> unsigned int imma_startup(NCSMDS_SVC_ID sv_id); >> 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 >> @@ -30,6 +30,7 @@ >> #include "osaf_poll.h" >> #include "osaf_extended_name.h" >> #include "saAis.h" >> +#include "mds_dl_api.h" >> >> >> /***************************************************************************** >> global data used by IMMA >> @@ -207,6 +208,11 @@ static uint32_t imma_destroy(NCSMDS_SVC_ >> IMMA_CB *cb = &imma_cb; >> TRACE_ENTER(); >> >> + if (mds_auth_server_disconnect(imma_sockname, >> + cb->imma_mds_adest, 10000) != NCSCC_RC_SUCCESS) { >> + LOG_WA("%s: mds_auth_server_disconnect failed", __FUNCTION__); >> + } >> + >> /* MDS unregister. */ >> imma_mds_unregister(cb); >> >> 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 >> @@ -29,7 +29,7 @@ >> #include "ncs_util.h" >> #include "mds_dl_api.h" >> >> -static const char *sockname = PKGLOCALSTATEDIR "/immnd.sock"; >> +const char *imma_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); >> @@ -420,16 +420,17 @@ static uint32_t imma_mds_svc_evt(IMMA_CB >> case NCSMDS_UP: >> TRACE_3("IMMND UP"); >> >> 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, >> + if (mds_auth_server_connect(imma_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__); >> } >> >> + cb->is_immnd_up = true; >> + >> 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*/ >> >> ------------------------------------------------------------------------------ >> Want excitement? >> Manually upgrade your production database. >> When you want reliability, choose Perforce >> Perforce version control. Predictably reliable. >> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk >> _______________________________________________ >> Opensaf-devel mailing list >> Opensaf-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/opensaf-devel >> ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel