POST timers and temporary anchors

Hi All,


I've got a questions regarding POST (again.. :) . In the HTTP.c file, there's this snippet (at the end of the FlushPutEvent function):

   ...
    /*
    **  If the callback returned something else than HT_OK then delete
    **  the timer, otherwise update it to a much shorter expiration
    **  time so that we can write some more data to the net.
    */
    if (status != HT_OK) {
 HTTimer_delete(http->timer);
 http->timer = NULL;
    } else if (!http->repetitive_writing) {
 http->timer = HTTimer_new(NULL, FlushPutEvent, http, HTRepeatWrite, YES, YES);
 http->repetitive_writing = YES;
    }
    return HT_OK;
}

So if the status of the upload (e.g. POST) was not HT_OK, we delete the timer, otherwise we just overwrite it w/ a newly created one. The question is: shouldn't we delete the timer in both cases first. I've failed to see why we have to delete it in the first case and simply overwrite it (the pointer, I mean) in the second.


Another thing. When doing lots of POSTs, I get memory leak. It seems that it is caused by the HTAnchor objects that are associated w/ the temporary files (all different, thus require different anchors) POST generates to send the data. Since Anchors linger around forever (or at least 'till the library gets terminated), this causes a leak (for me, at least :)
Does anybody have any idea when and where is best to free these anchors? I guess the application could do it, but I'd rather do it in libwww.

I appreciate any help.
Thanks,
Attila

Received on Thursday, 26 April 2001 10:13:01 UTC