Ben Laurie wrote:
>
> Stefano Ravaioli wrote:
>
> > nFD=accept(nSocket,&saClient,&nLen);
> > HandleClient(nFD);
> >
> > so if accept() fails, for example on EINTR, it goes on whith
> > HandleClient() and an invalid socket, it then calls ReadThing() and the
> > read() in saferead() returns 0 or -1, both values cause assert(nRead ==
> > sizeof usLength) to fail and gcache exit (it can also happen that the
> > user hits stop in the browser...).
>
> Hmmm ... not clear to me why accept() should get an EINTR, however, if
> it fails it shouldn't call HandleClient(), so I'm fixing that (and
> logging the failure). I'm hoping that this will be sufficient to cure
> the problem...
>
You're right, It shouldn't.
gcache is exec'd and no signal handler installed, accept() shouldn't get
an EINTR.
Too used to handle it...
So checking EINTR on accept() shouldn't help with gcache failure,
probably checking accept() failure will.
The useful part of my change should be the client side, checking for
failed connect() and going on without exiting.
Ciao,
Stefano