summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2018-10-11 14:09:37 +0200
committerDimitri Staessens <dimitri.staessens@ugent.be>2018-10-11 14:54:21 +0200
commita1b6cebe14d6e0689655a0c4d06064728cbf1f21 (patch)
tree38d8533f59a064b492e89e9b0c090eed802dd09a /src
parent9b8d2830250ecffb298f6c72196cffb94991f4d1 (diff)
downloadouroboros-a1b6cebe14d6e0689655a0c4d06064728cbf1f21.tar.gz
ouroboros-a1b6cebe14d6e0689655a0c4d06064728cbf1f21.zip
ipcpd: Take correct lock when updating stats
The lock of the wrong fd was taken when updating the stats in the DT component. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Diffstat (limited to 'src')
-rw-r--r--src/ipcpd/normal/dt.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ipcpd/normal/dt.c b/src/ipcpd/normal/dt.c
index dc7343f1..54346458 100644
--- a/src/ipcpd/normal/dt.c
+++ b/src/ipcpd/normal/dt.c
@@ -532,12 +532,14 @@ static void packet_handler(int fd,
if (ipcp_flow_write(dt_pci.eid, sdb)) {
ipcp_sdb_release(sdb);
#ifdef IPCP_FLOW_STATS
- pthread_mutex_lock(&dt.stat[dt_pci.eid].lock);
+ pthread_mutex_lock(&dt.stat[fd].lock);
++dt.stat[fd].rcv_pkt[qc];
dt.stat[fd].rcv_bytes[qc] += len;
+ pthread_mutex_unlock(&dt.stat[fd].lock);
+
+ pthread_mutex_lock(&dt.stat[dt_pci.eid].lock);
++dt.stat[dt_pci.eid].w_drp_pkt[qc];
dt.stat[dt_pci.eid].w_drp_bytes[qc] += len;
-
pthread_mutex_unlock(&dt.stat[dt_pci.eid].lock);
#endif