diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-15 19:47:12 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-15 19:52:35 +0900 |
commit | d815c3143d982fece79937fc27d74cabf3601cf9 (patch) | |
tree | 46cda2776c33f1f2955303dd385ee4bdc9856904 /server/peer.go | |
parent | d2d88bfb929d40e788def9ce85749dbc85d0f02f (diff) |
server: fix a bug that conneciton is closed before sending notification
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/peer.go b/server/peer.go index ec3f3f10..4e6f2ff3 100644 --- a/server/peer.go +++ b/server/peer.go @@ -275,7 +275,18 @@ func (peer *Peer) loop() error { } } case FSM_MSG_BGP_MESSAGE: - peer.handleBGPmessage(e.MsgData.(*bgp.BGPMessage)) + switch m := e.MsgData.(type) { + case *bgp.MessageError: + h.fsm.outgoing <- bgp.NewBGPNotificationMessage(m.TypeCode, m.SubTypeCode, m.Data) + case *bgp.BGPMessage: + peer.handleBGPmessage(m) + default: + log.WithFields(log.Fields{ + "Topic": "Peer", + "Key": peer.peerConfig.NeighborAddress, + "Data": e.MsgData, + }).Panic("unknonw msg type") + } } case m := <-peer.serverMsgCh: peer.handleServerMsg(m) |