X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fldp.c;h=36cff2a67f18c29a4c482dea457de84d5792601e;hb=72f7782dc57305ac86094dd16d7eccf8e0b74559;hp=088c118b6edec4e9f75a8d7f8800e71dd63ffadf;hpb=31df49c39f2e3bea3cf85150cdac170845f2efd7;p=vpp.git 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;