diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2016-01-08 18:45:03 +0100 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2016-01-09 15:01:55 +0000 |
commit | 2a801b48293e3f15b4fc352557fd97fef58a9666 (patch) | |
tree | 0961b79abcee4f8ab3e7ea14abfa5b08e879129b /epan/dissectors/packet-aeron.c | |
parent | e530a09a12f4eb845b1e6c0a52a7f0b24a1d7e0d (diff) |
[aeron] simplify aeron_frame_info_setup()
exit straight away if the packet was already processed or if we're
missing some data
avoid nested if clauses that make the code hard to read
Change-Id: Ied6d575f9498ab98623cd862a9d4b9dd8ad7e0b4
Reviewed-on: https://code.wireshark.org/review/13146
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-aeron.c')
-rw-r--r-- | epan/dissectors/packet-aeron.c | 80 |
1 files changed, 37 insertions, 43 deletions
diff --git a/epan/dissectors/packet-aeron.c b/epan/dissectors/packet-aeron.c index ea6383d7bf..33589c18b4 100644 --- a/epan/dissectors/packet-aeron.c +++ b/epan/dissectors/packet-aeron.c @@ -1448,56 +1448,50 @@ static void aeron_frame_stream_analysis_setup(packet_info * pinfo, aeron_packet_ static void aeron_frame_info_setup(packet_info * pinfo, aeron_transport_t * transport, aeron_packet_info_t * info, aeron_frame_info_t * finfo) { - if (transport != NULL) + if (!transport || !aeron_sequence_analysis || !finfo || PINFO_FD_VISITED(pinfo)) + return; + + if ((info->info_flags & AERON_PACKET_INFO_FLAGS_STREAM_ID_VALID) != 0) { - if (aeron_sequence_analysis && (finfo != NULL)) - { - if (PINFO_FD_VISITED(pinfo) == 0) - { - if ((info->info_flags & AERON_PACKET_INFO_FLAGS_STREAM_ID_VALID) != 0) - { - aeron_stream_t * stream; + aeron_stream_t * stream; - stream = aeron_transport_stream_find(transport, info->stream_id); - if (stream == NULL) - { - stream = aeron_transport_stream_add(transport, info->stream_id); - } - if ((info->info_flags & AERON_PACKET_INFO_FLAGS_TERM_ID_VALID) != 0) - { - aeron_term_t * term; - gboolean new_term = FALSE; + stream = aeron_transport_stream_find(transport, info->stream_id); + if (stream == NULL) + { + stream = aeron_transport_stream_add(transport, info->stream_id); + } + if ((info->info_flags & AERON_PACKET_INFO_FLAGS_TERM_ID_VALID) != 0) + { + aeron_term_t * term; + gboolean new_term = FALSE; - term = aeron_stream_term_find(stream, info->term_id); - if (term == NULL) - { - term = aeron_stream_term_add(stream, info->term_id); - new_term = TRUE; - } - if ((info->info_flags & AERON_PACKET_INFO_FLAGS_TERM_OFFSET_VALID) != 0) - { - aeron_frame_stream_analysis_setup(pinfo, info, finfo, stream, term, new_term); - } - else - { - aeron_term_frame_add(term, finfo, 0); - if (info->type == HDR_TYPE_NAK) - { - aeron_frame_nak_analysis_setup(info, finfo, term); - } - } - } - else - { - aeron_stream_frame_add(stream, finfo, 0); - } - } - else + term = aeron_stream_term_find(stream, info->term_id); + if (term == NULL) + { + term = aeron_stream_term_add(stream, info->term_id); + new_term = TRUE; + } + if ((info->info_flags & AERON_PACKET_INFO_FLAGS_TERM_OFFSET_VALID) != 0) + { + aeron_frame_stream_analysis_setup(pinfo, info, finfo, stream, term, new_term); + } + else + { + aeron_term_frame_add(term, finfo, 0); + if (info->type == HDR_TYPE_NAK) { - aeron_transport_frame_add(transport, finfo, 0); + aeron_frame_nak_analysis_setup(info, finfo, term); } } } + else + { + aeron_stream_frame_add(stream, finfo, 0); + } + } + else + { + aeron_transport_frame_add(transport, finfo, 0); } } |