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: <>
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 

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.

Received on Thursday, 25 May 2000 09:53:17 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:52 UTC