ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 7149] fast conversation lookup

Date: Thu, 19 Apr 2012 08:45:06 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7149

--- Comment #6 from Cristian Constantin <const.crist@xxxxxxxxxxxxxx> 2012-04-19 08:45:05 PDT ---
(In reply to comment #4)
> (In reply to comment #1)
> > Created attachment 8272 [details]
> > fast conversation lookup by cacheing the latest found element
> 
> This patch doesn't look correct to me.
> 
> you added:
> + if((match->latest_found)&&(match->latest_found->setup_frame<=frame_num))
> +     return match->latest_found;
> 
> What if latest_found->setup_frame = 1?
> It'll be always true.
> 
> So conversation_lookup_hashtable
> will return either match->last or match->latest_found.
> 
> Please look at logic in for() loop.
> 
> We also need to check if latest_found->{next->...->next}->setup_frame <=
> frame_num
> 
> 
> What we can do is:
>     if((match->latest_found)&&(match->latest_found->setup_frame<=frame_num))
>         conversation = latest_found;
>     else
>         conversation = match->next;
>     for (; conversation; conversation = conversation->next) {
>           /* ... *
> 
> (and I'm not quite sure about it)

cristian: you are right. basically we need to check that this is the last
conversation in the chain list with a setup frame which is less than the
current one.

> 
> Not O(1), sorry.

cristian: most likely not in general. but it seems that in this particular case
it is (i.e.: all the frames are loaded in increasing order, one after another).
should I post the patch having the changes suggested by you?

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.