W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2000

RE: Bug fix to HTHost.c

From: Maarten <mrten@dds.nl>
Date: Thu, 25 May 2000 09:51:12 -0400 (EDT)
To: www-lib@w3.org
Message-id: <4.3.2.6.2.20000525152650.00cbe340@localhost>
I've had a problem like this; in HTEvtLst.c, HTEventList_Loop(), the 
select call returned -1, specifically an WSAEINVAL error. One of the 
sockets in the FdArray was invalid.

When going throught the logs, I noticed that one of the sockets *was* 
removed from the HashTable[], but *not* from the FdArray[]. Then I 
noticed that HTEventList_unregister(), called just before, logged this:

Event....... Socket 140 unregistered for HTEvent_READ
Event....... Couldn't find socket 140. Can't unregister type 
HTEvent_WRITE

Now, I don't know why the program can't unegister HTEvent_WRITE, but I 
do know that in this call the socket gets removed from the HashTable[], 
but not from the FdArray.

Another problem surfaced, sometimes one socket arose multiple times in 
the FdArray. I guess this should not be happening. Therefore, I changed 
the FD_CLR call in HTEventList_unregister to :

while (FD_ISSET(s,FdArray+HTEvent_INDEX(type)))
	FD_CLR(s, FdArray+HTEvent_INDEX(type));

which took care of the second problem, and I added the same lines to 
the last part of HTEventList_unregister:

	if (THD_TRACE) {
		if (ret == HT_ERROR){
			HTTRACE(THD_TRACE, "Event....... Couldn't find socket %d. 
...			while (FD_ISSET(s,FdArray+HTEvent_INDEX(type)))
				FD_CLR(s, FdArray+HTEvent_INDEX(type));
		}
	}
	return ret;
}

This fixed the problem as far as I know. It is not the correct fix, 
though. This just solved the symptoms, not the actual problem.

dd,
Mrten.
Received on Thursday, 25 May 2000 09:53:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:36 GMT