aboutsummaryrefslogtreecommitdiffstats
path: root/epan/circuit.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-11-28 08:12:07 +0000
committerGuy Harris <guy@alum.mit.edu>2002-11-28 08:12:07 +0000
commit436a7d98576dde33fccdfd0c24a59d72b8209838 (patch)
treedef2024898fb0e4f8d65f4fac4c0e61f746a6454 /epan/circuit.c
parenta32fd6466339831f949e30c4c04061a50aacf695 (diff)
Don't keep the first frame around for circuits; we assume that a given
circuit begins either at the beginning of the capture or right after the previous circuit ends. svn path=/trunk/; revision=6694
Diffstat (limited to 'epan/circuit.c')
-rw-r--r--epan/circuit.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/epan/circuit.c b/epan/circuit.c
index e8cbbef0da..f2439c7cd3 100644
--- a/epan/circuit.c
+++ b/epan/circuit.c
@@ -1,7 +1,7 @@
/* circuit.c
* Routines for building lists of packets that are part of a "circuit"
*
- * $Id: circuit.c,v 1.5 2002/11/27 22:44:41 guy Exp $
+ * $Id: circuit.c,v 1.6 2002/11/28 08:12:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -144,7 +144,6 @@ circuit_new(circuit_type ctype, guint32 circuit_id, guint32 first_frame)
circuit = g_mem_chunk_alloc(circuit_chunk);
circuit->next = NULL;
- circuit->first_frame = first_frame;
circuit->last_frame = 0; /* not known yet */
circuit->index = new_index;
circuit->data_list = NULL;
@@ -193,7 +192,7 @@ circuit_t *
find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame)
{
circuit_key key;
- circuit_t *circuit;
+ circuit_t *circuit, *prev_circuit;
key.ctype = ctype;
key.circuit_id = circuit_id;
@@ -202,20 +201,22 @@ find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame)
* OK, search the list of circuits with that type and ID for
* a circuit whose range of frames includes that frame number.
*/
- for (circuit = g_hash_table_lookup(circuit_hashtable, &key);
- circuit != NULL; circuit = circuit->next) {
+ for (circuit = g_hash_table_lookup(circuit_hashtable, &key), prev_circuit = NULL;
+ circuit != NULL; prev_circuit = circuit, circuit = circuit->next) {
/*
- * The frame includes that frame number if:
+ * This circuit includes that frame number if:
*
- * the circuit's first frame is unknown or is at or
- * before that frame
+ * there is no previous circuit or the previous
+ * circuit's last frame is before that frame
+ * (so that the previous circuit doesn't include
+ * that frame)
*
* and
*
* the circuit's last frame is unknown or is at or
* after that frame.
*/
- if ((circuit->first_frame == 0 || circuit->first_frame <= frame)
+ if ((prev_circuit == NULL || prev_circuit->last_frame < frame)
&& (circuit->last_frame == 0 || circuit->last_frame >= frame))
break;
}