summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vcom.c6
-rw-r--r--src/vcl/vcom_socket.c23
2 files changed, 17 insertions, 12 deletions
diff --git a/src/vcl/vcom.c b/src/vcl/vcom.c
index ed52bfac8e4..624f0247e47 100644
--- a/src/vcl/vcom.c
+++ b/src/vcl/vcom.c
@@ -196,12 +196,10 @@ close (int __fd)
if (is_vcom_socket_fd (__fd) || is_vcom_epfd (__fd))
{
if (VCOM_DEBUG > 0)
- vcom_socket_main_show ();
+ fprintf (stderr, "[%d] close: fd %d\n", pid, __fd);
rv = vcom_close (__fd);
if (VCOM_DEBUG > 0)
- fprintf (stderr, "[%d] close: " "'%04d'='%04d'\n", pid, rv, __fd);
- if (VCOM_DEBUG > 0)
- vcom_socket_main_show ();
+ fprintf (stderr, "[%d] close: vcom_close() returned %d\n", pid, rv);
if (rv != 0)
{
errno = -rv;
diff --git a/src/vcl/vcom_socket.c b/src/vcl/vcom_socket.c
index 6fcc4e5820e..b2d6f58d794 100644
--- a/src/vcl/vcom_socket.c
+++ b/src/vcl/vcom_socket.c
@@ -2860,7 +2860,7 @@ vcom_socket_epoll_pwait (int __epfd, struct epoll_event *__events,
int rv = -EBADF;
int rv2;
double time_to_wait = (double) 0;
- double timeout;
+ double timeout, now = 0;
vcom_epoll_t *vepoll;
i32 vep_idx;
static struct epoll_event *libc_ev = 0;
@@ -2875,8 +2875,7 @@ vcom_socket_epoll_pwait (int __epfd, struct epoll_event *__events,
goto out;
}
- time_to_wait = ((__timeout > 0) ?
- (double) __timeout / (double) 1000 : (double) __timeout);
+ time_to_wait = ((__timeout >= 0) ? (double) __timeout / (double) 1000 : 0);
vep_idx = vcom_socket_get_vep_idx_and_vepoll (__epfd, &vepoll);
if (vep_idx == INVALID_VEP_IDX)
@@ -2899,7 +2898,8 @@ vcom_socket_epoll_pwait (int __epfd, struct epoll_event *__events,
{
if (VCOM_DEBUG > 2)
fprintf (stderr, "[%d] vcom_socket_epoll_pwait: libc_cnt = 0, "
- "calling vppcom_epoll_wait()\n", getpid ());
+ "calling vppcom_epoll_wait() time_to_wait = %f\n",
+ getpid (), time_to_wait);
rv = vppcom_epoll_wait (vep_idx, __events, __maxevents, time_to_wait);
}
else if (vepoll->vcl_cnt == 0)
@@ -2913,14 +2913,20 @@ vcom_socket_epoll_pwait (int __epfd, struct epoll_event *__events,
{
if (VCOM_DEBUG > 2)
fprintf (stderr, "[%d] vcom_socket_epoll_pwait: vcl_cnt = %d, "
- "libc_cnt = %d -> mixed polling\n", getpid (),
- vepoll->vcl_cnt, vepoll->libc_cnt);
+ "libc_cnt = %d -> mixed polling (time_to_wait = %f, "
+ "__timeout = %d)\n",
+ getpid (), vepoll->vcl_cnt, vepoll->libc_cnt,
+ time_to_wait, __timeout);
vec_validate (libc_ev, __maxevents);
timeout = clib_time_now (&vsm->clib_time) + time_to_wait;
do
{
rv = vppcom_epoll_wait (vep_idx, __events, __maxevents, 0);
rv2 = libc_epoll_pwait (__epfd, libc_ev, __maxevents, 1, __ss);
+ if (VCOM_DEBUG == 666)
+ fprintf (stderr, "[%d] vcom_socket_epoll_pwait: "
+ "rv = %d, rv2 = %d, timeout = %f, now = %f\n",
+ getpid (), rv, rv2, timeout, now);
if ((rv > 0) || (rv2 > 0))
{
if (VCOM_DEBUG > 2)
@@ -2949,9 +2955,10 @@ vcom_socket_epoll_pwait (int __epfd, struct epoll_event *__events,
}
goto out;
}
+ if (__timeout != -1)
+ now = clib_time_now (&vsm->clib_time);
}
- while ((__timeout == -1)
- || (clib_time_now (&vsm->clib_time) < timeout));
+ while (now < timeout);
}
out:
='n263' href='#n263'>263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326