ldp: ignore TCP_CORK socket option
[vpp.git] / src / vcl / vcl_locked.c
index f5892c1..5539191 100644 (file)
@@ -435,6 +435,7 @@ vls_mt_acq_locks (vcl_locked_session_t * vls, vls_mt_ops_t op, int *locks_acq)
        }
       break;
     case VLS_MT_OP_WRITE:
+      ASSERT (s);
       if (!is_nonblk)
        is_nonblk = vcl_session_write_ready (s) != 0;
       if (!is_nonblk)
@@ -467,7 +468,7 @@ vls_mt_rel_locks (int locks_acq)
 
 #define vls_mt_guard(_vls, _op)                                \
   int _locks_acq = 0;                                  \
-  if (PREDICT_FALSE (vcl_get_worker_index () == ~0));  \
+  if (PREDICT_FALSE (vcl_get_worker_index () == ~0))   \
     vls_mt_add ();                                     \
   if (PREDICT_FALSE (vlsl->vls_mt_n_threads > 1))      \
     vls_mt_acq_locks (_vls, _op, &_locks_acq);         \
@@ -561,6 +562,9 @@ vls_attr (vls_handle_t vlsh, uint32_t op, void *buffer, uint32_t * buflen)
   vcl_locked_session_t *vls;
   int rv;
 
+  if (PREDICT_FALSE (vcl_get_worker_index () == ~0))
+    vls_mt_add ();
+
   if (!(vls = vls_get_w_dlock (vlsh)))
     return VPPCOM_EBADFD;
   rv = vppcom_session_attr (vls_to_sh_tu (vls), op, buffer, buflen);
@@ -734,6 +738,9 @@ vls_epoll_create (void)
   vcl_session_handle_t sh;
   vls_handle_t vlsh;
 
+  if (PREDICT_FALSE (vcl_get_worker_index () == ~0))
+    vls_mt_add ();
+
   sh = vppcom_epoll_create ();
   if (sh == INVALID_SESSION_ID)
     return VLS_INVALID_HANDLE;
@@ -861,6 +868,9 @@ vls_unshare_vcl_worker_sessions (vcl_worker_t * wrk)
   vcl_locked_session_t *vls;
   vcl_session_t *s;
 
+  if (pool_elts (vcm->workers) <= 1)
+    return;
+
   current_wrk = vcl_get_worker_index ();
   is_current = current_wrk == wrk->wrk_index;
   vls_table_wlock ();