I've been making some developments under OSX and iOS and was trying to use udt's epoll with both UDT and SYS sockets. After noticing that the epoll_wait wasn't firing events for SYS sockets I delved into the code and found out that when the OS was not Linux the code invokes select() by default for SYS sockets, which was my case.
Then I found out that the problem was that select() was being invoked with the first argument equal to 0, which should be (max_fd + 1), where max_fd is the maximum file descriptor of all descriptors being monitored. You can confirm this in the select man page.
So, I made a small fix to determine the max_fd and invoke select() with (max_fd + 1) as the first argument.
In the future I may try to add kqueue support for SYS sockets when on OSX / iOS.
Thanks for the awesome project!
Hi,
Please ignore the previous file and use this one instead.
SF doesn't let me edit my patch request even though it's open.
Thanks!
Shouldn't any errors encountered by select() be propagated to the caller too?
Hi Mikhail,
Since error handling isn't being done in neither native epoll() or select(), I didn't include it.
My guess is that the reason for this was to not interrupt normal UDT CEPoll::wait() behavior unless the error was UDT related.
You could add error handling, but to be consistent with the existing code you would have to do something like
(...) // epoll() or select() call
else // error
{
CGuard::leaveCS(m_EPollLock);
throw CUDTException(X, Y); // new exceptions
}
(...)
which would obviously interrupt the CEPoll::wait() call.
One could however create a specific error handling which would print something to stderr based on errno value. That would be better than nothing I guess.
Cheers