summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/ldp.c12
-rw-r--r--src/vcl/vppcom.c21
2 files changed, 16 insertions, 17 deletions
diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c
index 088c118b6ed..36cff2a67f1 100644
--- a/src/vcl/ldp.c
+++ b/src/vcl/ldp.c
@@ -2142,7 +2142,7 @@ ldp_epoll_pwait (int epfd, struct epoll_event *events, int maxevents,
int timeout, const sigset_t * sigmask)
{
ldp_worker_ctx_t *ldpw = ldp_worker_get_current ();
- double time_to_wait = (double) 0, time_out, now = 0;
+ double time_to_wait = (double) 0, max_time;
int libc_epfd, rv = 0;
vls_handle_t ep_vlsh;
@@ -2167,7 +2167,7 @@ ldp_epoll_pwait (int epfd, struct epoll_event *events, int maxevents,
}
time_to_wait = ((timeout >= 0) ? (double) timeout / 1000 : 0);
- time_out = clib_time_now (&ldpw->clib_time) + time_to_wait;
+ max_time = clib_time_now (&ldpw->clib_time) + time_to_wait;
libc_epfd = vls_attr (ep_vlsh, VPPCOM_ATTR_GET_LIBC_EPFD, 0, 0);
if (PREDICT_FALSE (libc_epfd < 0))
@@ -2179,8 +2179,7 @@ ldp_epoll_pwait (int epfd, struct epoll_event *events, int maxevents,
LDBG (2, "epfd %d: vep_idx %d, libc_epfd %d, events %p, maxevents %d, "
"timeout %d, sigmask %p: time_to_wait %.02f", epfd, ep_vlsh,
- libc_epfd, events, maxevents, timeout, sigmask, time_to_wait,
- time_out);
+ libc_epfd, events, maxevents, timeout, sigmask, time_to_wait);
do
{
if (!ldpw->epoll_wait_vcl)
@@ -2207,11 +2206,8 @@ ldp_epoll_pwait (int epfd, struct epoll_event *events, int maxevents,
if (rv != 0)
goto done;
}
-
- if (timeout != -1)
- now = clib_time_now (&ldpw->clib_time);
}
- while (now < time_out);
+ while ((timeout == -1) || (clib_time_now (&ldpw->clib_time) < max_time));
done:
return rv;
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index f181f35ee27..c91d0f4b8b6 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2601,31 +2601,34 @@ vcl_epoll_wait_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
if (!(session = vcl_session_get (wrk, sid)))
break;
session_events = session->vep.ev.events;
- if (EPOLLOUT & session_events)
- {
- add_event = 1;
- events[*num_ev].events |= EPOLLOUT;
- session_evt_data = session->vep.ev.data.u64;
- }
+ if (!(EPOLLOUT & session_events))
+ break;
+ add_event = 1;
+ events[*num_ev].events |= EPOLLOUT;
+ session_evt_data = session->vep.ev.data.u64;
break;
case SESSION_CTRL_EVT_DISCONNECTED:
disconnected_msg = (session_disconnected_msg_t *) e->data;
session = vcl_session_disconnected_handler (wrk, disconnected_msg);
if (!session)
break;
+ session_events = session->vep.ev.events;
+ if (!((EPOLLHUP | EPOLLRDHUP) & session_events))
+ break;
add_event = 1;
events[*num_ev].events |= EPOLLHUP | EPOLLRDHUP;
session_evt_data = session->vep.ev.data.u64;
- session_events = session->vep.ev.events;
break;
case SESSION_CTRL_EVT_RESET:
sid = vcl_session_reset_handler (wrk, (session_reset_msg_t *) e->data);
if (!(session = vcl_session_get (wrk, sid)))
break;
+ session_events = session->vep.ev.events;
+ if (!((EPOLLHUP | EPOLLRDHUP) & session_events))
+ break;
add_event = 1;
events[*num_ev].events |= EPOLLHUP | EPOLLRDHUP;
session_evt_data = session->vep.ev.data.u64;
- session_events = session->vep.ev.events;
break;
case SESSION_CTRL_EVT_REQ_WORKER_UPDATE:
vcl_session_req_worker_update_handler (wrk, e->data);
@@ -2710,7 +2713,7 @@ vppcom_epoll_wait_condvar (vcl_worker_t * wrk, struct epoll_event *events,
double total_wait = 0, wait_slice;
int rv;
- wait_for_time = (wait_for_time == -1) ? (double) 10e9 : wait_for_time;
+ wait_for_time = (wait_for_time == -1) ? (double) 1e6 : wait_for_time;
wait_slice = wrk->cut_through_registrations ? 10e-6 : wait_for_time;
do