On Tue, 2005-04-12 at 05:25 +0200, Christian Biere wrote:
> Alex Bennee wrote:
> > On Wed, 2005-04-06 at 11:30 +0200, Christian Biere wrote:
> > > I haven't looked at the surrounding code...but - if possible - propagate
> > > the current time from a higher call because time() is "somewhat" heavy
> 
> > I can't see any easy way to reduce the cost. For live tickets this will
> > occur every 10s or so. On startup the cost will be higher, but if the
> > user has that many tickets in their cache....
> 
> Well, OK. However, you probably want to limit the number of tickets to hold
> in the cache then for the future.

Its a tricky one. Because I don't want to go to the hassle of
regenerating XML tickets from our memory cached data (the bitzi_data_t
structures which are expired properly) I'm cheating by re-rechoing the
Bitzi tickets as is. This of course means all the validation for
re-importing them is on start-up which could be some time after the
ticket expired.

Of course there is a startup cost involved parseing all these tickets
anyway. I suggest we keep and eye on it and I could possibly add some
code at a later date to reset the the file if bitzi_cache_clean comes up
empty (and therefor all the file cached entries will also have expired).
 

> > > > +               while (fgets(tmp, sizeof(tmp), old_data))
> > > > +               {
> > > Keep in mind that the line might be truncated now.
> > Should only be truncated on an EOL, so shouldn't break the <?xml test
> 
> Not really. There are at least 2 special cases concerning fgets() to
> look out for: 1. The line is longer than the buffer, 2. the line
> may contain NUL bytes. In the latter case, you'd probably just consider
> the file corrupt. The other case can be "ignored" as well if you're sure
> that you never create longer lines.

The line may well be longer than the buffer, but the xmlParser can read
part chunks without a problem. The only thing it relies on is the <?xml
is always at the start. If its not the xmlParse will fail and we should
skip that ticket.

> > This patch is not currently well tested as Bitzi seems to be generating
> > wierd XML tickets at the moment.
> 
> Do you want it in CVS or is it still a preview?

Bitzi is back up and working so I've given it a spin overnight. It all
seems to be working well enough. If your happy to push it to CVS then go
for it. I can look at some of the suggested extra clean ups once we are
back in sync ;-)

--
Alex, homepage: http://www.bennee.com/~alex/
"I'm growing older, but not up." -- Jimmy Buffett



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Gtk-gnutella-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to