ConfD User Community

Query on confd_sync_audit_notification

Hi,

In my implementation, I have subscribed for the following events from CONFD,
CONFD_NOTIF_USER_SESSION |
CONFD_NOTIF_STREAM_EVENT | CONFD_NOTIF_AUDIT | CONFD_NOTIF_AUDIT_SYNC |
CONFD_NOTIF_COMMIT_FAILED;

and here is how my notification processing code looks like.

                            
int retVal = confd_read_notification(confdNotifSock, &n);
switch(n.type) {
    case CONFD_NOTIF_AUDIT:
            if(CONFD_CLI_CMD == n.n.audit.logno)
            {
                    ProcessCommand..............                                                   
            }
                                            
            confd_sync_audit_notification(confdNotifSock,n.n.audit.usid);
                                            break;
    case CONFD_NOTIF_USER_SESSION:
        PRINT( "got user session notifications from confd " << 
n.n.user_sess.type << " " << n.n.user_sess.uinfo.username);
        switch(n.n.user_sess.type)
        {
            case CONFD_USER_SESS_STOP:
            PRINT( "received user session stop notification");
            stopUserSessionImpl(&n.n.user_sess.uinfo);
            break;
            case CONFD_USER_SESS_START:
            PRINT( "received user session start notification");
            startUserSessionImpl(&n.n.user_sess.uinfo);
            break;
            default:
            break;
        }
        break;
    case CONFD_NOTIF_DAEMON:
    case CONFD_NOTIF_NETCONF:
    case CONFD_NOTIF_DEVEL:
    PRINT( "got Confd Deamon/NetConf/devel Notifications");
    break;
    case CONFD_NOTIF_COMMIT_FAILED:
    PRINT( "Commit failed, system is in unclear state");
    break;
    case CONFD_NOTIF_STREAM_EVENT:
    switch (n.n.stream.type)
    {
      case CONFD_STREAM_NOTIFICATION_COMPLETE:
          PRINT( "Confd Stream notif complete");
           break;
      case CONFD_STREAM_REPLAY_COMPLETE:
           PRINT( "Replay completed");
           break;
      case CONFD_STREAM_NOTIFICATION_EVENT:
           PRINT( "stream notification event complete");
            confd_free_notification(&n);
           SyncFS();
            break;
      case CONFD_STREAM_REPLAY_FAILED:
           PRINT( "Replay Failed" << "error is " << n.n.stream.replay_error);
           break;
      default:
           break;
    }
    break;
    default:
    break;
   }
   }
}

whenever I receive CONFD_USER_SESS_START confd gets stuck at the call to cdb_set_elem() method which I’m calling from startuserSession() to start a new worker thread.
my code works fine if I don’t subscribe for CONFD_NOTIF_AUDIT_SYNC or if I call confd_sync_audit_notification() for CONFD_NOTIF_USER_SESSION events also.

does this mean I have to call confd_sync_audit_notification even when I review CONFD_NOTIF_USER_SESSION events? as per confd user guide, we only need to call it for CONFD_NOTIF_AUDIT

Thanks

Try splitting the CONFD_USER_SESS_START receiver and initiator of the user session into two separate threads.