diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2018-03-08 06:29:11 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-03-08 13:45:44 +0100 |
commit | d90f7f88d0c8cf3f96c10896f4c6fa4f6a138bf0 (patch) | |
tree | 34c0ffb4d732f55871f346855a09db56d5c57540 /src/ipcpd/normal/dt.c | |
parent | dde082e5f37457f8914857714093c534ccf8d845 (diff) | |
download | ouroboros-d90f7f88d0c8cf3f96c10896f4c6fa4f6a138bf0.tar.gz ouroboros-d90f7f88d0c8cf3f96c10896f4c6fa4f6a138bf0.zip |
ipcpd: Fix bytes sent in send statistics
The number of bytes sent was not counting the data transfer PCI. This
is now fixed.
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/ipcpd/normal/dt.c')
-rw-r--r-- | src/ipcpd/normal/dt.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/ipcpd/normal/dt.c b/src/ipcpd/normal/dt.c index 68cd498f..da03d9b8 100644 --- a/src/ipcpd/normal/dt.c +++ b/src/ipcpd/normal/dt.c @@ -363,12 +363,12 @@ static void sdu_handler(int fd, #else (void) fd; #endif - memset(&dt_pci, 0, sizeof(dt_pci)); - dt_pci_des(sdb, &dt_pci); #ifdef IPCP_FLOW_STATS len = shm_du_buff_tail(sdb) - shm_du_buff_head(sdb); #endif + memset(&dt_pci, 0, sizeof(dt_pci)); + dt_pci_des(sdb, &dt_pci); if (dt_pci.dst_addr != ipcpi.dt_addr) { if (dt_pci.ttl == 0) { log_dbg("TTL was zero."); @@ -741,13 +741,13 @@ int dt_write_sdu(uint64_t dst_addr, #endif assert(sdb); assert(dst_addr != ipcpi.dt_addr); -#ifdef IPCP_FLOW_STATS - len = shm_du_buff_tail(sdb) - shm_du_buff_head(sdb); -#endif + fd = pff_nhop(dt.pff[qc], dst_addr); if (fd < 0) { log_dbg("Could not get nhop for addr %" PRIu64 ".", dst_addr); #ifdef IPCP_FLOW_STATS + len = shm_du_buff_tail(sdb) - shm_du_buff_head(sdb); + pthread_mutex_lock(&dt.stat[np1_fd].lock); ++dt.stat[np1_fd].lcl_r_pkt[qc]; @@ -766,9 +766,14 @@ int dt_write_sdu(uint64_t dst_addr, if (dt_pci_ser(sdb, &dt_pci)) { log_dbg("Failed to serialize PDU."); +#ifdef IPCP_FLOW_STATS + len = shm_du_buff_tail(sdb) - shm_du_buff_head(sdb); +#endif goto fail_write; } - +#ifdef IPCP_FLOW_STATS + len = shm_du_buff_tail(sdb) - shm_du_buff_head(sdb); +#endif ret = ipcp_flow_write(fd, sdb); if (ret < 0) { log_dbg("Failed to write SDU to fd %d.", fd); |