Add node name of sender in trans_data msg

This commit is contained in:
gc87
2022-03-04 14:00:03 +08:00
parent c01225dcda
commit 2eff71d508
9 changed files with 27 additions and 38 deletions
+2
View File
@@ -820,6 +820,7 @@ static void adapter_loop(void *arg)
req.buf_len = sizeof(neu_reqresp_data_t);
req.buf = (void *) &data_req;
req.sender_id = trans_data->sender_id;
req.node_name = trans_data->node_name;
intf_funs->request(adapter->plugin, &req);
if (is_need_free) {
neu_dvalue_free(data_req.data_val);
@@ -1650,6 +1651,7 @@ static int adapter_response(neu_adapter_t *adapter, neu_response_t *resp)
trans_data = (neuron_trans_data_t *) msg_get_buf_ptr(pay_msg);
trans_data->grp_config = neu_data->grp_config;
trans_data->sender_id = to_node_id((adapter), (adapter)->id);
trans_data->node_name = adapter->name;
trans_buf = &trans_data->trans_buf;
rv = neu_trans_buf_init(trans_buf, adapter->trans_kind,
neu_data->data_val);
+1
View File
@@ -175,6 +175,7 @@ typedef struct grp_config_changed_event {
typedef struct neuron_trans_data {
neu_taggrp_config_t *grp_config;
adapter_id_t sender_id; // adapter_id of sender
char * node_name;
neu_trans_buf_t trans_buf;
} neuron_trans_data_t;
+1
View File
@@ -969,6 +969,7 @@ static int dispatch_databuf_to_adapters(neu_manager_t * manager,
(neu_taggrp_config_t *) neu_taggrp_cfg_ref(
neu_trans_data->grp_config);
out_neu_trans_data->sender_id = neu_trans_data->sender_id;
out_neu_trans_data->node_name = neu_trans_data->node_name;
neu_trans_buf_copy(&out_neu_trans_data->trans_buf, trans_buf);
nng_msg_set_pipe(out_msg, msg_pipe);
log_debug("Forward databuf to pipe: %d", msg_pipe);