diff options
author | Paul Warren <pdw@ex-parrot.com> | 2021-12-27 18:30:41 +0000 |
---|---|---|
committer | Paul Warren <pdw@ex-parrot.com> | 2021-12-27 18:30:41 +0000 |
commit | 6fcf06736323bce306cae2b597c7ab1e7496b206 (patch) | |
tree | 13822deae64e17b81f1452c0a1754ec903a95763 | |
parent | bb5caf21244d0753ac3ecd3cf39463f4964790ef (diff) |
Use tick mutex to protect history hash.origin/combine-interfaces
Luke Dashjr <luke@dashjr.org>
-rw-r--r-- | iftop.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -444,6 +444,7 @@ static void handle_ip_packet(struct ip* iptr, int hw_dir, int pld_len) break; } + pthread_mutex_lock(&tick_mutex); if(hash_find(history, &ap, u_ht.void_pp) == HASH_STATUS_KEY_NOT_FOUND) { ht = history_create(); hash_insert(history, &ap, ht); @@ -459,6 +460,7 @@ static void handle_ip_packet(struct ip* iptr, int hw_dir, int pld_len) len = 1; break; default: + pthread_mutex_unlock(&tick_mutex); return; } @@ -485,6 +487,7 @@ static void handle_ip_packet(struct ip* iptr, int hw_dir, int pld_len) history_totals.total_sent += len; } + pthread_mutex_unlock(&tick_mutex); } static void handle_raw_packet(unsigned char* args, const struct pcap_pkthdr* pkthdr, const unsigned char* packet) |