[jdev] Why are we doing math on socket handles?
Tim Anderson
tima at predator-software.com
Mon Apr 4 15:08:58 CDT 2005
in mio_connect:
fd = socket(sa.ss_family,SOCK_STREAM,0)
and in mio_fd
if(fd >= m->maxfd)
{
mio_debug(ZONE,"fd to high");
return -1;
}
I know I'm a stupid windows programmer, but who cares what value the socket
handle is? There's a malloced array that uses the socket handle as an index,
obviously. This just seems inherently silly. There's also a problem in that
SOME of these maximum numbers are configurable:
r->mio = mio_new(r->io_max_fds);
c2s->mio = mio_new(c2s->io_max_fds);
and some are hard coded:
r->mio = mio_new(1023);
s2s->mio = mio_new(1024);
sm->mio = mio_new(1024);
So 1) Why are we doing math on socket handles? 2) I'm assuming adding this
into the configuration files is the right way to work around this problem. I
always thought hard coding numbers in code was bad. I guess that's just a
silly habit picked up by coding in windows instead of unix all these years.
Tim
tima at predator-software.com
More information about the JDev
mailing list