Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Paul Warren
iftop
Commits
6fcf0673
Commit
6fcf0673
authored
Dec 27, 2021
by
Paul Warren
Browse files
Use tick mutex to protect history hash.
Luke Dashjr <luke@dashjr.org>
parent
bb5caf21
Changes
1
Hide whitespace changes
Inline
Side-by-side
iftop.c
View file @
6fcf0673
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment