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:
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user