debug_fe_client("Got native message for session-id %" PRIu64,
msg->refer_id);
- if (msg->code != MGMT_MSG_CODE_NOTIFY) {
- session = mgmt_fe_find_session_by_session_id(client,
- msg->refer_id);
- if (!session || !session->client) {
- log_err_fe_client("No session for received native msg session-id %" PRIu64,
- msg->refer_id);
- return;
- }
+ session = mgmt_fe_find_session_by_session_id(client, msg->refer_id);
+ if (!session || !session->client) {
+ log_err_fe_client("No session for received native msg session-id %" PRIu64,
+ msg->refer_id);
+ return;
}
switch (msg->code) {
tree_msg->partial_error);
break;
case MGMT_MSG_CODE_NOTIFY:
+ if (!session->client->cbs.async_notification)
+ return;
+
notify_msg = (typeof(notify_msg))msg;
if (msg_len < sizeof(*notify_msg)) {
log_err_fe_client("Corrupt notify-data msg recv");
notify_msg->result_type);
return;
}
- FOREACH_SESSION_IN_LIST (client, session) {
- if (!session->client->cbs.async_notification)
- continue;
- session->client->cbs
- .async_notification(client, client->user_data,
- session->client_id,
- session->user_ctx, data);
- }
+ session->client->cbs.async_notification(client,
+ client->user_data,
+ session->client_id,
+ msg->refer_id,
+ session->user_ctx, data);
+
if (notify_msg->result_type != LYD_JSON)
darr_free(data);
break;
/* Called with asynchronous notifications from backends */
int (*async_notification)(struct mgmt_fe_client *client,
uintptr_t user_data, uint64_t client_id,
- uintptr_t session_ctx, const char *result);
+ uint64_t session_id, uintptr_t session_ctx,
+ const char *result);
/* Called when new native error is returned */
int (*error_notify)(struct mgmt_fe_client *client, uintptr_t user_data,