From fc50c62104b3019ff4de9e4fcc5b6f04b74a664a Mon Sep 17 00:00:00 2001 From: Jens Lorenz Date: Thu, 7 Jun 2018 18:04:03 +0200 Subject: AMUtil: Fix inconsistent fdPollingArray In case someone removed a fd and closed it opened a new one and added it to the socket handler the container state of the object in map was changed from either REMOVE/CLOSE to UNINIT. This leads to the emplace call in the fdPollingArray vector and the fd is maintained twice. Over the entire runtime there will be zombie fds provided to ppoll functions which will race a POLLERR revent leading to 100% cpu load. Also the CLOSE state is now removed because only the application is aware if a fd has to be closed. For instance calling add/remove in a loop were start_listenting is not running will turn to a system issue were no fds can be provided by the operation system. Signed-off-by: Jens Lorenz --- AudioManagerUtilities/include/CAmSocketHandler.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'AudioManagerUtilities/include/CAmSocketHandler.h') diff --git a/AudioManagerUtilities/include/CAmSocketHandler.h b/AudioManagerUtilities/include/CAmSocketHandler.h index 797551d..db3207e 100644 --- a/AudioManagerUtilities/include/CAmSocketHandler.h +++ b/AudioManagerUtilities/include/CAmSocketHandler.h @@ -50,7 +50,6 @@ namespace am typedef uint16_t sh_pollHandle_t; //! check, std::function dispatch, void* userData, sh_pollHandle_t& handle); am_Error_e addFDPoll(const int fd, const short event, IAmShPollPrepare *prepare, IAmShPollFired *fired, IAmShPollCheck *check, IAmShPollDispatch *dispatch, void* userData, sh_pollHandle_t& handle); - am_Error_e removeFDPoll(const sh_pollHandle_t handle, const sh_rmv_e rmv = RMV_ONLY); + am_Error_e removeFDPoll(const sh_pollHandle_t handle); am_Error_e updateEventFlags(const sh_pollHandle_t handle, const short events); am_Error_e addSignalHandler(std::function callback, sh_pollHandle_t& handle, void * userData); am_Error_e removeSignalHandler(const sh_pollHandle_t handle); -- cgit v1.2.1