If I am epoll_wait () on a listening socket, and when epoll_wait () returns an indication that it has activity (in this case, the connection is waiting to be accepted () ed), then if the call to accept () ends with errno = EINTR, will Does epoll_wait () indicate that the next time it returns, the same connection is awaiting in the listener?
ie, I need to do something line by line:
while(1){ epoll_wait(epfd, &events, maxevents, timeout); if (events.data.fd == listener){ connsock = accept(listener, &addr, &addrlen); while (connsock != -1){ if (errno == EINTR){ accept(listener, &addr, &addrlen); } } } }
to make sure the connection is accepted, or it will work, and still make sure that the connection for which accept () was interrupted by a signal is accepted:
while(1){ epoll_wait(epfd, &events, maxevents, timeout); if (events.data.fd == listener){ connsock = accept(listener, &addr, &addrlen); } }
where in this case, if accept () is interrupted by a signal, it just picks up the same connection the next time through the loop after returning epoll_wait.
Obviously, in both of these examples I make some assumptions (that, for example, only one event in one socket is returned when the epoll_wait call is given) and excludes error checking (except for EINTR on accept (), since all of this is here) to simplify things