diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-18 23:16:40 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-18 23:16:40 +0900 |
commit | 97c124246d0b2e714d57eca814f95c0a82d97113 (patch) | |
tree | 3f877e9b9093df59c7a2e2eb6a2e8f04e115f976 /server/peer.go | |
parent | ec278710f10c2cae7d6b3e393aa957edfd536181 (diff) |
server: fix 'deleted config' race
When a config is deleted, goroutine for FSMHandler.h.Dying becomes
active. sendMessageloop must send notifcation before dying. So it
should not check Dying(). After sending notificaiton, it closes the
conneciton and return. It makes sure that rx goroutine will die too.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go index c86aabb5..3b03046b 100644 --- a/server/peer.go +++ b/server/peer.go @@ -267,7 +267,10 @@ func (peer *Peer) loop() error { case <-peer.t.Dying(): close(peer.acceptedConnCh) peer.outgoing <- bgp.NewBGPNotificationMessage(bgp.BGP_ERROR_CEASE, bgp.BGP_ERROR_SUB_PEER_DECONFIGURED, nil) - h.Wait() + // h.t.Kill(nil) will be called + // internall so even goroutines in + // non-established will be killed. + h.Stop() return nil case e := <-incoming: switch e.MsgType { |