[Python-checkins] r42254 - in python/branches/release24-maint: Misc/NEWS Modules/_ssl.c Modules/socketmodule.c

Neal Norwitz nnorwitz at gmail.com
Thu Feb 9 05:58:43 CET 2006


On 2/7/06, Jim Jewett <jimjjewett at gmail.com> wrote:
> Is there any other way that a file descriptor could be invalid?

Not that I know of.

> I keep wanting to see SOCKET_TOO_LARGE instead of
> SOCKET_INVALID since that is all it checks.

That makes sense and is a better name.

> Also, if I am understanding correctly, the problem isn't
> with the size of the socket, it is with the total number of
> file descriptors, and this socket just happened to get one
> outside the valid set (which is presumably numbered
> sequentially).

Basically yes.  If FD_SETSIZE is 4k and you get socket descriptor
5000, regardless of how many sockets are opened, 5000 can't be passed
into select().  You would get a buffer overrun when trying to set the
descriptor.

> Maybe SOCKET_INVALID_FD ?

What name do you prefer: SOCKET_INVALID_FD or SOCKET_TOO_LARGE or
something else?  It's literally SOCKET_TOO_LARGE_FOR_SELECT.  Maybe
that?

> (Also, would a negative number or float or something cause the
> same problems, except that they presumably get weeded out
> earlier?)

Yes, negative descriptors are already checked for everywhere I saw
(unless I missed some places).

n


More information about the Python-checkins mailing list