]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgp_fsm.c
bgpd: move bgp_connect_check() to bgp_fsm.c
authorQuentin Young <qlyoung@cumulusnetworks.com>
Fri, 24 Mar 2017 19:05:56 +0000 (19:05 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 30 Nov 2017 21:17:57 +0000 (16:17 -0500)
commit07a165268236fc64380d3abff46ae950e1799e65
tree52bb6efb5145a44b258190dc58a4bdf219773af1
parent80bd61c416c0dd51a2cc8b9dd67ac00e41cde20a
bgpd: move bgp_connect_check() to bgp_fsm.c

Prior to this change, after initiating a nonblocking connection to the
remote peer bgpd would call both BGP_READ_ON and BGP_WRITE_ON on the
peer's socket. This resulted in a call to select(), so that when some
event (either a connection success or failure) occurred on the socket,
one of bgp_read() or bgp_write() would run. At the beginning of each of
those functions was a hook into bgp_connect_check(), which checked the
socket status and issued the correct connection event onto the BGP FSM.

This code is better suited for bgp_fsm.c. Placing it there avoids
scheduling packet reads or writes when we don't know if the socket has
established a connection yet, and the specific functionality is a better
fit for the responsibility scope of this unit.

This change also helps isolate the responsibilities of the
packet-writing kernel thread.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_fsm.c
bgpd/bgp_packet.c