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 07:21:46 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7149

--- Comment #4 from Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx> 2012-04-19 07:21:46 PDT ---
(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)

Not O(1), sorry.

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