libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] Sockets on Windows


From: Michael Lenaghan
Subject: Re: [libmicrohttpd] Sockets on Windows
Date: Sun, 17 Jan 2010 17:00:01 -0500

>> Ideally you should test against INVALID_SOCKET. You can also test
>> against "-1"--but then you'd be relying on an implicit signed/unsigned
>> conversion.
>
> PlibC now uses ints instead of SOCKETs, so we don't have to change MHD.

Nils, I'm not sure I understand. Sockets on Windows are unsigned ints.
If Windows returns an unsigned int with its high bit set it will be
interpreted as a negative number and fail a test for "< 0" even though
it's a valid socket. Furthermore, since MHD will think the socket
never opened it will never close it either, resulting in a resource
leak.

>> Obviously, select() on Windows is not what you'd use if you were
>> worried about heavy load--so I think constraining max connections
>> would be reasonable.
>
> Right now, I think we should leave things as they are. If someone needs
> to handle more than 64 read/write/error/result sockets, s/he can
> increase FD_SETSIZE accordingly. Or is there something I have not taken
> into account?

You may want to make FD_SETSIZE the ceiling (and possibly the default)
for max_connections on Windows. (If you FD_SET more than that many
they'll just be ignored anyway.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]