diff options
| -rw-r--r-- | bgpd/bgp_fsm.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_packet.c | 8 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index f775bd048f..ab4ea71d61 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -688,7 +688,7 @@ bgp_adjust_routeadv (struct peer *peer) * * m > MRAI */ - diff = difftime(nowtime, peer->last_write); + diff = difftime(nowtime, peer->last_update); if (diff > (double) peer->v_routeadv) { BGP_TIMER_OFF(peer->t_routeadv); diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index ae54cd43d3..6811513448 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -341,6 +341,7 @@ bgp_write (struct thread *thread) u_char type; struct stream *s; int num; + int update_last_write = 0; unsigned int count = 0; unsigned int oc = 0; @@ -432,6 +433,7 @@ bgp_write (struct thread *thread) /* OK we send packet so delete it. */ bgp_packet_delete (peer); + update_last_write = 1; } while (++count < peer->bgp->wpkt_quanta && (s = bgp_write_packet (peer)) != NULL); @@ -439,8 +441,12 @@ bgp_write (struct thread *thread) bgp_write_proceed_actions (peer); done: - /* Update the last write if some updates were written. */ + /* Update last_update if UPDATEs were written. */ if (peer->update_out > oc) + peer->last_update = bgp_clock (); + + /* If we TXed any flavor of packet update last_write */ + if (update_last_write) peer->last_write = bgp_clock (); sockopt_cork (peer->fd, 0); diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 2aa90e4877..cc55fb87d1 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -789,7 +789,8 @@ struct peer /* Syncronization list and time. */ struct bgp_synchronize *sync[AFI_MAX][SAFI_MAX]; time_t synctime; - time_t last_write; /* timestamp when the last UPDATE msg was written */ + time_t last_write; /* timestamp when the last msg was written */ + time_t last_update; /* timestamp when the last UPDATE msg was written */ /* Send prefix count. */ unsigned long scount[AFI_MAX][SAFI_MAX]; |
