osaf/libs/core/mds/include/mds_core.h |   1 +
 osaf/libs/core/mds/mds_c_db.c         |  29 +++++++++++++++++++++++++++++
 osaf/libs/core/mds/mds_c_sndrcv.c     |  17 +++++++++++++----
 3 files changed, 43 insertions(+), 4 deletions(-)


- The existing Opensaf Broadcast message was implemented such that the Bcast 
messes will be send to
  only the active subscribers as multiple unicast,  assuming that the 
subscription list may have n_way_active & n_way.

- But currently we don't have any n_way configuration in the current Opensaf 
middle ware ,
  and so far we didn't come across such n_way configuration application.

- In case of Multicast Messaging TIPC to send a copy of the message to every 
port in the sender's cluster
  irrelevant of role of the subscriber ( assuming application will filter it 
based on active/standby)

-  So to match  existing Opensaf Broadcast message , i am providing this Option 
patch as well.

- If community thinks this is required we will push this optional patch ,
  otherwise we will attach this to ticket for future use when we will suppor 
n_way .

Code changes :

Before sending the Multicast Messaging , query the subscribers  for  any 
standby exist (n_way subscribers list) ,
if  (if standby exist)  send old type Broadcast message as multiple unicast 
only to actives , else
in the case of n_way_active configuration  sends Multicast Message.

diff --git a/osaf/libs/core/mds/include/mds_core.h 
b/osaf/libs/core/mds/include/mds_core.h
--- a/osaf/libs/core/mds/include/mds_core.h
+++ b/osaf/libs/core/mds/include/mds_core.h
@@ -468,6 +468,7 @@ extern uint32_t mds_subtn_res_tbl_getnex
 extern uint32_t mds_subtn_res_tbl_getnext_active(MDS_SVC_HDL svc_hdl, 
MDS_SVC_ID subscr_svc_id, MDS_SUBSCRIPTION_RESULTS_INFO **result);       /* use 
for bcast */
 
 extern uint32_t mds_subtn_res_tbl_getnext_any(MDS_SVC_HDL svc_hdl, MDS_SVC_ID 
subscr_svc_id, MDS_SUBSCRIPTION_RESULTS_INFO **result);  /* use for red bcast */
+extern bool mds_subtn_tbl_nway_query(MDS_SVC_HDL svc_hdl, MDS_SVC_ID 
subscr_svc_id);
 
 extern uint32_t mds_subtn_res_tbl_query_next_active(MDS_SVC_HDL svc_hdl, 
MDS_SVC_ID sub_svc_id,
                                                 MDS_VDEST_ID vdest_id,
diff --git a/osaf/libs/core/mds/mds_c_db.c b/osaf/libs/core/mds/mds_c_db.c
--- a/osaf/libs/core/mds/mds_c_db.c
+++ b/osaf/libs/core/mds/mds_c_db.c
@@ -2072,6 +2072,35 @@ uint32_t mds_subtn_res_tbl_getnext_activ
 }
 
 /*********************************************************
+  Function NAME: mds_subtntbl_standby_query
+*********************************************************/
+bool mds_subtn_tbl_nway_query(MDS_SVC_HDL svc_hdl, MDS_SVC_ID subscr_svc_id)
+{                               
+                
+        MDS_SUBSCRIPTION_RESULTS_INFO *subtn_res_info;
+                                
+        m_MDS_LOG_DBG("MCM_DB : Entering : mds_subtn_res_tbl_getnext_active");
+        
+       subtn_res_info = (MDS_SUBSCRIPTION_RESULTS_INFO 
*)ncs_patricia_tree_getnext
+           (&gl_mds_mcm_cb->subtn_results, (uint8_t *)NULL);
+                           
+        while (subtn_res_info != NULL) {                                       
  
+                if (svc_hdl == subtn_res_info->key.svc_hdl &&
+                    subscr_svc_id == subtn_res_info->key.sub_svc_id &&
+                    V_DEST_RL_STANDBY == subtn_res_info->info.vdest_inst.role) 
{
+                    m_MDS_LOG_DBG("MCM_DB : Leaving : F : 
mds_subtn_tbl_nway_query : Standby Result present");   
+                    return true;
+                    
+                }
+                subtn_res_info =
+                    (MDS_SUBSCRIPTION_RESULTS_INFO 
*)ncs_patricia_tree_getnext(&gl_mds_mcm_cb->subtn_results,
+                                                                               
(uint8_t *)&(subtn_res_info->key));
+        }
+        m_MDS_LOG_DBG("MCM_DB : Leaving : F : mds_subtn_tbl_nway_query : 
Standby Result not present");
+        return false;
+}
+
+/*********************************************************
   Function NAME: mds_subtn_res_tbl_getnext_any
 *********************************************************/
 uint32_t mds_subtn_res_tbl_getnext_any(MDS_SVC_HDL svc_hdl, MDS_SVC_ID 
subscr_svc_id,
diff --git a/osaf/libs/core/mds/mds_c_sndrcv.c 
b/osaf/libs/core/mds/mds_c_sndrcv.c
--- a/osaf/libs/core/mds/mds_c_sndrcv.c
+++ b/osaf/libs/core/mds/mds_c_sndrcv.c
@@ -1345,6 +1345,7 @@ static uint32_t mcm_msg_encode_full_or_f
        MDTM_SEND_REQ msg_send;
        MDS_BCAST_BUFF_LIST *bcast_ptr = NULL;
        MDS_SUBSCRIPTION_RESULTS_INFO *lcl_subtn_res = NULL;
+       bool dest_is_nway = false;
        memset(&msg_send, 0, sizeof(msg_send));
 
        m_MDS_LOG_DBG("MDS_SND_RCV : Entering 
mcm_msg_encode_full_or_flat_and_send prev_ver_sub_count :%d \n",
@@ -1478,6 +1479,10 @@ static uint32_t mcm_msg_encode_full_or_f
        mds_get_subtn_res_tbl_by_adest(svc_cb->svc_hdl, to_svc_id,
                        dest_vdest_id, adest, &lcl_subtn_res);
                        
+       /* Fist check subscriptions list is  n_way type for this svc_id
+          if yes we need to send Bcast message as multi-unicast only for 
active*/
+       if (snd_type == MDS_SENDTYPE_BCAST) 
+               dest_is_nway = mds_subtn_tbl_nway_query(svc_cb->svc_hdl, 
to_svc_id);
 
        msg_send.svc_seq_num = lcl_subtn_res->msg_snd_cnt++;
        msg_send.src_svc_id = svc_cb->svc_id;
@@ -1493,7 +1498,7 @@ static uint32_t mcm_msg_encode_full_or_f
        msg_send.dest_vdest_id = dest_vdest_id;
        msg_send.src_svc_sub_part_ver = svc_cb->svc_sub_part_ver;
 
-       if ((((svc_cb->subtn_info->prev_ver_sub_count > 0)) 
+       if ((((svc_cb->subtn_info->prev_ver_sub_count > 0) || (dest_is_nway == 
true)) 
                                && (snd_type == MDS_SENDTYPE_BCAST || snd_type 
== MDS_SENDTYPE_RBCAST))
                        && (strcmp(tipc_or_tcp, "TIPC") == 0)){
                /* Mark as Previous version arch_word */
@@ -3761,7 +3766,7 @@ static uint32_t mcm_pvt_process_svc_bcas
        MDS_SUBSCRIPTION_RESULTS_INFO *info_result = NULL;
        uint8_t to;
        uint32_t status = 0;
-
+       bool dest_is_nway = false;
 
        if (to_msg.msg_type == MSG_NCSCONTEXT) {
                if (to_msg.data.msg == NULL) {
@@ -3814,7 +3819,10 @@ static uint32_t mcm_pvt_process_svc_bcas
                } 
        } 
 
-
+       /* Fist check subscriptions list is  n_way type for this svc_id
+          if yes we need to send Bcast message as multi-unicast only for 
active*/
+       if (flag == 0) 
+               dest_is_nway = mds_subtn_tbl_nway_query(svc_cb->svc_hdl, 
to_svc_id);
 
        /* Get each destination and send */
        while (1) {
@@ -3875,7 +3883,8 @@ static uint32_t mcm_pvt_process_svc_bcas
 
                status = mds_mcm_send_msg_enc(to, svc_cb, &to_msg, to_svc_id, 
info_result->key.vdest_id,
                                req, 0, info_result->key.adest, pri);
-               if ((svc_cb->subtn_info->prev_ver_sub_count == 0) && 
(strcmp(tipc_or_tcp, "TIPC") == 0)) {
+               if ((svc_cb->subtn_info->prev_ver_sub_count == 0) && 
(strcmp(tipc_or_tcp, "TIPC") == 0) 
+                               && (dest_is_nway == false)) {
                        m_MDS_LOG_DBG("MDTM: Break while(1) prev_ver_sub_count: 
%d  SVCid =%d  data.len: %d ", 
                                        svc_cb->subtn_info->prev_ver_sub_count,
                                        
m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_cb->svc_hdl), to_msg.data.info.len);  

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to