On 26 August 2015 at 23:28, Matt Durgavich mattdurgavich@gmail.com wrote:
Bruno wrote a patch a while back that tracked sockets in a linked list, and the feedback there was to use a hashing scheme similar to how files are handled since sockets, like files, can be opened and closed rapidly.
I must have missed that mail. Do you have a message ID or a link to the mailing list archive?
Chip made this point re ws2_32 tracking sockets:
"The second option I gave might be preferable, because e.g. someone could DuplicateHandle() a winsock handle into another process, and WSACleanup() might not close it when it runs. (Someone should write a test for that.)”
Tests would certainly be useful.
For the server side approach, I’d need to map the fd back to a handle that can be closed.
Well, no, you'd just enumerate all the socket handles in the process' handle table.
Can we get a consensus here as to the right approach? I don’t want to polish a patch that is wrong-headed.
I can't necessarily tell you what the right approach is, I've only spent about 10 minutes looking at the problem. But I'm fairly sure a hash table in ws2_32 isn't it.