diff options
Diffstat (limited to 'epan/packet.c')
-rw-r--r-- | epan/packet.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/epan/packet.c b/epan/packet.c index be85cbb3b8..aeb55aa377 100644 --- a/epan/packet.c +++ b/epan/packet.c @@ -2752,6 +2752,7 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb, const char *saved_curr_proto; const char *saved_heur_list_name; GSList *entry; + GSList *prev_entry = NULL; guint16 saved_can_desegment; guint saved_layers_len = 0; heur_dtbl_entry_t *hdtbl_entry; @@ -2835,9 +2836,17 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb, } if (len) { *heur_dtbl_entry = hdtbl_entry; + + /* Bubble the matched entry to the top for faster search next time. */ + if (prev_entry != NULL) { + prev_entry = g_slist_remove_link(prev_entry, entry); + sub_dissectors->dissectors = g_slist_concat(entry, sub_dissectors->dissectors); + } + status = TRUE; break; } + prev_entry = entry; } pinfo->current_proto = saved_curr_proto; |