session: fix io_evt mq locking 51/22351/2
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>
Fri, 27 Sep 2019 15:04:47 +0000 (17:04 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 27 Sep 2019 16:27:09 +0000 (16:27 +0000)
Type: fix

Change-Id: Iaa8045bba19cc305c84074668a20e1468d431b10
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
src/vnet/session/application_interface.h

index 637a055..015a297 100644 (file)
@@ -495,14 +495,13 @@ app_send_io_evt_to_vpp (svm_msg_q_t * mq, u32 session_index, u8 evt_type,
   else
     {
       svm_msg_q_lock (mq);
-      while (svm_msg_q_ring_is_full (mq, SESSION_MQ_IO_EVT_RING))
+      while (svm_msg_q_ring_is_full (mq, SESSION_MQ_IO_EVT_RING)
+            || svm_msg_q_is_full (mq))
        svm_msg_q_wait (mq);
       msg = svm_msg_q_alloc_msg_w_ring (mq, SESSION_MQ_IO_EVT_RING);
       evt = (session_event_t *) svm_msg_q_msg_data (mq, &msg);
       evt->session_index = session_index;
       evt->event_type = evt_type;
-      if (svm_msg_q_is_full (mq))
-       svm_msg_q_wait (mq);
       svm_msg_q_add_and_unlock (mq, &msg);
       return 0;
     }