diff options
author | Lou Berger <lberger@labn.net> | 2018-01-07 15:41:53 +0100 |
---|---|---|
committer | Lou Berger <lberger@labn.net> | 2018-01-22 21:19:15 +0100 |
commit | eb2277cf2dd8205e02d9bdf19814ddd1b299ceae (patch) | |
tree | 541439005c18450c87d3bf98baa82451edb8cc4f /bgpd/bgp_io.c | |
parent | Merge pull request #1566 from chiragshah6/ospfv3_dev (diff) | |
download | frr-eb2277cf2dd8205e02d9bdf19814ddd1b299ceae.tar.xz frr-eb2277cf2dd8205e02d9bdf19814ddd1b299ceae.zip |
bgpd: update last_update whenever obuf sent
(to be consistent with last_write updates)
Signed-off-by: Lou Berger <lberger@labn.net>
Diffstat (limited to 'bgpd/bgp_io.c')
-rw-r--r-- | bgpd/bgp_io.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 98a8ec6e0..f4bfc90b7 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -375,14 +375,10 @@ static uint16_t bgp_write(struct peer *peer) int num; int update_last_write = 0; unsigned int count = 0; - uint32_t oc; - uint32_t uo; + uint32_t uo = 0; uint16_t status = 0; uint32_t wpkt_quanta_old; - // save current # updates sent - oc = atomic_load_explicit(&peer->update_out, memory_order_relaxed); - // cache current write quanta wpkt_quanta_old = atomic_load_explicit(&peer->bgp->wpkt_quanta, memory_order_relaxed); @@ -419,6 +415,7 @@ static uint16_t bgp_write(struct peer *peer) case BGP_MSG_UPDATE: atomic_fetch_add_explicit(&peer->update_out, 1, memory_order_relaxed); + uo++; break; case BGP_MSG_NOTIFY: atomic_fetch_add_explicit(&peer->notify_out, 1, @@ -457,9 +454,12 @@ static uint16_t bgp_write(struct peer *peer) } done : { - /* Update last_update if UPDATEs were written. */ - uo = atomic_load_explicit(&peer->update_out, memory_order_relaxed); - if (uo > oc) + /* + * Update last_update if UPDATEs were written. + * Note: that these are only updated at end, + * not per message (i.e., per loop) + */ + if (uo) atomic_store_explicit(&peer->last_update, bgp_clock(), memory_order_relaxed); |