-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Hi,
While working on the recent PRs I noticed there could be some room for optimization. I'm looking into that now but I had some questions:
Callbacks from the native to BSD layer have to iterate over the socket list and find the appropriate BSD socket. Seems it would be better to store a pointer from the native socket back to the BSD socket that owns it. But maybe there is some reason why you hadn't done that?
I do see for the ICMP callback:
Line 1845 in 70d84f2
| * \note a single ICMP message may apply to several UDP sockets. |
Is that still true? I don't see how it's possible. One BSD socket can only "own" one native socket, no?
I did see you had the idea once to store the Socket*s in a hash table. I finished the implementation for it now, but as long as there is so much iterating going on, it wouldn't be any faster.
Also I was looking into optimizing select_s()/poll(). I see select_s() has code to check DOS FDs too, but currently it will skip those and set errno = ENOTSOCK. So which is it? Should select_s() be able to work with DOS FDs? It would simplify things a bit if it didn't.
Edit: didn't see the check for SK_FIRST. So stdin/stdout/stderr should be allowed.