1
0
mirror of https://github.com/bgp/stayrtr.git synced 2024-05-06 15:54:54 +00:00

Ensure error PDUs are sent before the TCP socket closes

This was intro'd in 6e4c533e8a08fab823a30d236dee661a447c9952
Since I did not expect the sending PDU channel to be _slightly_
slower than just yeeting the socket closed instantly.

Regardless, TCP disconnection now happens when the sendloop is dead,
that should allow for Error PDUs etc to be sent out before

Tag: https://github.com/bgp/stayrtr/issues/90
This commit is contained in:
Ben Cartwright-Cox
2023-02-24 14:13:45 +00:00
parent df1dbde933
commit 8a3a71e045

View File

@ -807,6 +807,8 @@ func (c *Client) passSimpleHandler(pdu PDU) {
}
func (c *Client) sendLoop() {
defer c.tcpconn.Close()
for c.connected {
select {
case pdu := <-c.transmits:
@ -1196,6 +1198,4 @@ func (c *Client) Disconnect() {
case c.quit <- true:
default:
}
c.tcpconn.Close()
}