W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2001

Re: bug in HTEvtLst.c

From: Fengyun Cao <fcao@CS.Princeton.EDU>
Date: Sun, 25 Mar 2001 19:43:03 -0500 (EST)
To: Jens Meggers <jens.meggers@firepad.com>
cc: "'www-lib@w3.org'" <www-lib@w3.org>
Message-ID: <Pine.LNX.4.30.0103251937130.11220-100000@gentoo.CS.Princeton.EDU>
Cool!
I have a question now about connect on unix:
in HTDoConnect of HTTCP.c, case tcpstate of TCP_NEED_CONNECT, it only
register HTEvent_CONNECT for Windows. So what if it's running on unix
under non-preemptive mode? Should it also register HTEvent_WRITE?


THanks,

Fengyun

Meggers wrote:

> Hi,
>
> there is a bug in the procedure EventListTimerHandler() in HTEvtLst.c.
> There is missing a handler for the connect timeout. I guess the connenct
> timeout is only of use under windows. Without that additional handler code,
> the windows event based system stucks from time to time. Thus, we should add
> it. Please check the code below. I added the code that is labeled /* Check
> for connect timeout */.
>
> Regards,
>
> Jens
>
>
> /*
> **  Event timeout handler
> **  If an event didn't occur before the timeout then call it explicitly
> **  indicating that it timed out.
> */
> PRIVATE int EventListTimerHandler (HTTimer * timer, void * param,
> HTEventType type)
> {
>     SockEvents * sockp = (SockEvents *) param;
>     HTEvent * event = NULL;
> 	int code;
>
>     /* Check for read timeout */
>     if (sockp->timeouts[HTEvent_INDEX(HTEvent_READ)] == timer) {
> 	event = sockp->events[HTEvent_INDEX(HTEvent_READ)];
> 	HTTRACE(THD_TRACE, "Event....... READ timed out on %d.\n" _
> sockp->s);
> 	return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT);
>     }
>
>     /* Check for write timeout */
>     if (sockp->timeouts[HTEvent_INDEX(HTEvent_WRITE)] == timer) {
> 	event = sockp->events[HTEvent_INDEX(HTEvent_WRITE)];
> 	HTTRACE(THD_TRACE, "Event....... WRITE timed out on %d.\n" _
> sockp->s);
> 	return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT);
>     }
>
>     /* Check for connect timeout */
>     if (sockp->timeouts[HTEvent_INDEX(HTEvent_CONNECT)] == timer) {
> 	event = sockp->events[HTEvent_INDEX(HTEvent_CONNECT)];
> 	HTTRACE(THD_TRACE, "Event....... CONNECT timed out on %d.\n" _
> sockp->s);
> 	printf("Connect timed out!\n");
> 	code = (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT);
>
> 	// delete event
> 	HTEventList_unregister (sockp->s, HTEvent_CONNECT);
>
> 	return code;
>     }
>
>     /* Check for out-of-band data timeout */
>     if (sockp->timeouts[HTEvent_INDEX(HTEvent_OOB)] == timer) {
> 	event = sockp->events[HTEvent_INDEX(HTEvent_OOB)];
> 	HTTRACE(THD_TRACE, "Event....... OOB timed out on %d.\n" _
> sockp->s);
> 	return (*event->cbf) (sockp->s, event->param, HTEvent_TIMEOUT);
>     }
>     HTTRACE(THD_TRACE, "Event....... No event for timer %p with context
> %p\n" _ timer _ param);
>     return HT_ERROR;
> }
>
>
> ;---------------------------------------------------------------------
> Jens Meggers
> Director of Engineering
>
> Firepad, Inc.
> The Firepad Building
> 625 Ellis Street
> Mountain View, California 94043-2225
> Telephone (650) 237-3265
> Facsimile (650) 237-3299
> ;---------------------------------------------------------------------
>
>
>

-- 
****************************************************
Fengyun Cao
Computer Science Department   Princeton University
email: fcao@cs.princeton.edu
tel: (609)-258-6126
****************************************************
Received on Sunday, 25 March 2001 19:43:13 GMT

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