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

AW: problem with HTEvent_loop function

From: Markus Bäurle <m.baeurle@caa.de>
Date: Fri, 30 Mar 2001 13:42:48 +0200
Message-ID: <AAAEFDDFF161E1488A5A2D1300CDE54B034F4C@strm001.caa.de>
To: "'www-lib@w3.org'" <www-lib@w3.org>
Hello Hu,

you wrote:

> hi
> I am new to here. I am using libwww-5.3.2 under redhat linux 7.0.
> 
> I am trying to modify Library/Examples/postform.c as a function
>  so i can call in my program.I want use the result of a POST.
>  It's quite easy, but the problem I meet is when postform 
> returns, the program exits too. It happens in HTEvent_loop, this
>  function never returns, anything i could do to prevent this happen?

Look at terminate_handler(), it does a HTProfile_delete() and exit(0) after
the first request.
Remove these and put in a "return status;" and it should be fine.

But then there is another thing, I think this is what's happening (if not,
everybody please correct me): The socket is kept alive so that it can be
reused if another request to the same server is done. As long as it hasn't
timed out, HTEventList_loop() won't return.

We tried to put a HTEventList_stopLoop() as seen in chunkbody.c at the end
of terminate_handler(),
but this crashed with access violations on our NT systems.
This seems to be a bug though and only happens when WWW_WIN_ASYNC is not
#defined, so you should try to stop the loop first as you are running on
Linux. (We can't have WWW_WIN_ASYNC because then libwww won't work if IE 5.5
is on the system, see my older messages to this list.)
Just for the records, we disable connection-keep-alive with
HTRequest_addConnection(pHTRequest, "close", ""); so the event loop will end
after the request has completed.

But there is the little problem that, when a request times out because the
server is unreachable, the event loop will continue to run for about 20s
after our after filter has been called, which is a waste of time that we
want to remove.
But this probably means to get HTEventList_stopLoop() to work properly in
our environment.

Hope this helps,

Markus
Received on Friday, 30 March 2001 06:43:22 GMT

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