Socket Problems
Ian Piumarta
ian.piumarta at inria.fr
Fri Sep 12 19:16:41 UTC 2003
On Fri, 12 Sep 2003, Ian Piumarta wrote:
> So what I might do is to try moving the check for otherEndClosed forward
> into primSocketConnectionStatus to see if the image likes that better.
With that change, Andreas' example now gives me:
self statusString 'connected'
self getData 'Response'
self statusString 'otherEndClosedButNotThisEnd'
self getData immediate error 'getData timeout'
Lukas: replace sqSocketConnectionStatus() in your sqUnixSocket.c with the
attached version, recompile, and try to break your db connection again.
If it doesn't break any more then I'll include the changes in the next
release.
Cheers,
Ian
-------------- next part --------------
int sqSocketConnectionStatus(SocketPtr s)
{
if (!socketValid(s))
return Invalid;
/* we now know that the net session is valid, so if state is Invalid... */
if (SOCKETSTATE(s) == Invalid) /* see acceptHandler() */
{
fprintf(stderr, "socketStatus: freeing invalidated pss=%p\n", PSP(s));
/*free(PSP(s));*/ /* this almost never happens -- safer not to free()?? */
_PSP(s)= 0;
interpreterProxy->success(false);
return Invalid;
}
/* check for connection closed by peer */
if (SOCKETSTATE(s) == Connected)
{
int fd= SOCKET(s);
int n= socketReadable(fd);
if (n < 0)
{
FPRINTF((stderr, "socketStatus(%d): detected other end closed\n", fd));
SOCKETSTATE(s)= OtherEndClosed;
}
}
FPRINTF((stderr, "socketStatus(%d) -> %d\n", SOCKET(s), SOCKETSTATE(s)));
return SOCKETSTATE(s);
}
More information about the Squeak-dev
mailing list
|