Hi Christian

> Sorry to interrupt, but isn't the bug rather calling hcache_remove_all()
> from hcache_free()? Also, why is host_count 24 if hostlist is NULL?
> hcache_remove_all() was already called for all cache types in hcache_close()
> in the previous loop. By explicitely checking whether the caches are
> NULL or not, you simply shadow the real bug.

I double check this and try to make it so that hcache_free() fails if it
is called on non-empty caches. I also add more assertions to check that
the count is in sync with the hostlist.

> The code should also be changed to use a hash list. The manual list
> handling causes a unnecessary complexity and performance overhead. This
> should be directly possible by either using atoms for the hosts or
> modifying hashlist.c to support a custom comparison function - unless
> I missed something.

There is only one hashtable and 7 lists. With hashlist I would have 7
hashtables and 7 lists. The global hashtable is to make sure that a host
is always only in one list without having to check 7 different tables.
I think the way it is currently handled with respect to lists and
hashtables is ok. The way that the VALID and FRESH caches are linked
with each other could be improved though.

Thanks for checking my commit ;)
-- 
Richard Eckart <[EMAIL PROTECTED]>



-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to