Re: Problems with GET in event loop

Hi,

I had different code where I commented out the second fclose (long ago and
forgot about that change). So I guess that it is my fault :-(. 

I changed the code because after not closing the pointers an application ran
out of system's budget on open fps and did not behave properly. I thought that
since the library opened an fp that it is library's work to close it after
loading is performed. In previous profile (NewPreemtiveClient) everything worked
fine... 

I know - it is dangerous to mess with the code you do not completely
understand... Sorry about the confusion. And thanks for your time.

Olga. 


>         /* Set the output stream and start the request */
>         HTRequest_setOutputFormat(request, WWW_SOURCE);
>         HTRequest_setOutputStream(request, HTFWriter_new(request, fp,
> NO));
>         if (HTLoadAbsolute(url, request) == NO) {
>             fclose(fp);                               <---- here
>             return NO;
>         } else {
>             /*fclose(fp);*/
>             return YES;
          }



On 22-Dec-98 Henrik Frystyk Nielsen wrote:
> 
> 
> olga wrote:
>> I found the problem. In HTLoadToFile the file pointer was closed earlier
>> than
>> anything was written to file. Then writing to the file failed. So I just
>> commented out the closing of the file pointer in HTLoadToFile (HTAccess.c)
>> and
>> took care of that in the application.
>> 
>> Why it wrote the cache twice I have no idea - it doens't do it after it
>> writes
>> in file normally.
> 
> Great - I am wondering what the problem is so that we can fix it. I
> think the code in HTAccess.c HTLoadToFile(...) may cause the file to be
> closed twice (the handling of closing streams were changed some time
> ago). However, what I don't understand is why using non blocking sockets
> and the event loop would change that
> 
>         /* Set the output stream and start the request */
>         HTRequest_setOutputFormat(request, WWW_SOURCE);
>         HTRequest_setOutputStream(request, HTFWriter_new(request, fp,
> NO));
>         if (HTLoadAbsolute(url, request) == NO) {
>             fclose(fp);                               <---- here
>             return NO;
>         } else
>             return YES;
> 
> What part did you uncomment?
> 
> Thanks,
> 
> Henrik

----------------------------------
E-Mail: olga <olga@eai.com>
Date: 22-Dec-98
Time: 11:22:22

This message was sent by XFMail
----------------------------------

Received on Tuesday, 22 December 1998 12:38:53 UTC