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

RE: HTEventList_loop on Windows

From: Michel Philip <mphilip@infovista.com>
Date: Wed, 20 Feb 2002 11:54:56 -0500 (EST)
Message-ID: <F520B214418AD4119F7000508BD90CC294B9C1@hq01sr02.infovista.com>
To: www-lib@w3.org
Cc: "'Shigeyuki Fukushima'" <shige@sitc.toshiba.co.jp>
> Is this modification correct?

For me this is not correct.

My program does multiples requests.
(see the mget.c sample)
I don't want to exit the event loop
just because one of them is unreacheable.

> Or, do you have a nice idea for this problem?

I don't know if it is nice but here is how I do
"by request" timeouts:

  HTRequest request = HTRequest_new();
  HTRequest_setContext(request,  myReq);  
  myReq->timer = HTTimer_new(NULL, timer_callback, (void*)myReq, tm, true,

int timer_callback(HTTimer* timer, void * param, HTEventType type) 
    t_myReq *myReq = (t_myReq *)inst;
    HTRequest request = myReq->request;
    myReq->timer = NULL;

    // To kill the request use:
    HTNet *net = HTRequest_net(request);


-----Original Message-----
From: Shigeyuki Fukushima [mailto:shige@sitc.toshiba.co.jp] 
Sent: vendredi 15 février 2002 02:32
To: www-lib@w3.org
Cc: shige@sitc.toshiba.co.jp
Subject: HTEventList_loop on Windows


Now I'm using w3c-libwww-5.3.2 on x86/Windows platform.
I have found a fatal bug(?) in HTEventList_loop function.

When compiling Library/src/HTEvtLst.c with WWW_WIN_ASYNC definition.
`HTHost_setEventTimeout(60000);' operation has no effect for
main event loop.
When a program sent a http request for an unreachable URL, 
it cannot escape main event loop parmanently, even if
HTHost_setEventTimeout() is called before in loop.

Then, I tried to modify HTEvtLst.c as follows (add):

PUBLIC int HTEventList_loop (HTRequest * theRequest)

    MSG msg;
    int status;
    ms_t timeout;
    while (!HTEndLoop && GetMessage(&msg,0,0,0)) {
            /* add FROM */
            if ((status = HTTimer_next(&timeout)))
            /* add TO */

    status = HTEndLoop;
    /* Reset HTEndLoop in case we want to start again */
    HTEndLoop = 0;
    return (status == 1 ? HT_OK : HT_ERROR);

#else /* WWW_WIN_ASYNC */

Is this modification correct?
Or, do you have a nice idea for this problem?


--- shige
Shigeyuki Fukushima 
Received on Thursday, 21 February 2002 03:10:08 UTC

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