From 6f862c0dfedddff07e963b637170b574eb42d601 Mon Sep 17 00:00:00 2001 From: laurent Date: Fri, 2 Sep 2022 14:25:17 +0200 Subject: [PATCH] fix a bug in itti external sockets --- common/utils/ocp_itti/intertask_interface.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index da77b271a6..82f7eb5774 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -181,10 +181,10 @@ extern "C" { t->nb_fd_epoll--; } - static inline int itti_get_events_locked(task_id_t task_id, struct epoll_event *events, int nb_events) { + static inline int itti_get_events_locked(task_id_t task_id, struct epoll_event *events, int max_events) { task_list_t *t=tasks[task_id]; uint64_t current_time=0; - + int nb_events; do { if ( t->next_timer != UINT64_MAX ) { struct timespec tp; @@ -230,7 +230,7 @@ extern "C" { pthread_mutex_unlock(&t->queue_cond_lock); LOG_D(ITTI,"enter blocking wait for %s, timeout: %d ms\n", itti_get_task_name(task_id), epoll_timeout); - nb_events = epoll_wait(t->epoll_fd, events,t->nb_fd_epoll, epoll_timeout); + nb_events = epoll_wait(t->epoll_fd, events, max_events, epoll_timeout); if ( nb_events < 0 && (errno == EINTR || errno == EAGAIN ) ) pthread_mutex_lock(&t->queue_cond_lock); @@ -238,7 +238,9 @@ extern "C" { AssertFatal (nb_events >=0, "epoll_wait failed for task %s, nb fds %d, timeout %lu: %s!\n", - itti_get_task_name(task_id), t->nb_fd_epoll, t->next_timer != UINT64_MAX ? t->next_timer-current_time : -1, strerror(errno)); + itti_get_task_name(task_id), t->nb_fd_epoll, + t->next_timer != UINT64_MAX ? t->next_timer-current_time : -1, + strerror(errno)); LOG_D(ITTI,"receive on %d descriptors for %s\n", nb_events, itti_get_task_name(task_id)); if (nb_events == 0)