From 4c4bc4670cbae44696e3ddb14d56445dcacb59a8 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Mon, 14 Mar 2016 23:54:34 -0700 Subject: Revert "fsm: remove redundant connection close" when hold timer expires, established() goroutine exits so even if tx() goroutine writes to errorCh, nobody closes the connection. The, rx() goroutine doesn't finish, so gobgpd hits panic(). This reverts commit 38bd31856b5eff046a4874e83b53cb7d3e45cdaf. Conflicts: server/fsm.go --- server/fsm.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/fsm.go b/server/fsm.go index 168a0387..5fa12484 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -1005,6 +1005,7 @@ func (h *FSMHandler) sendMessageloop() error { } if err := conn.SetWriteDeadline(time.Now().Add(time.Second * time.Duration(fsm.pConf.Timers.State.NegotiatedHoldTime))); err != nil { h.errorCh <- FSM_WRITE_FAILED + conn.Close() return fmt.Errorf("failed to set write deadline") } _, err = conn.Write(b) @@ -1016,6 +1017,7 @@ func (h *FSMHandler) sendMessageloop() error { "Data": err, }).Warn("failed to send") h.errorCh <- FSM_WRITE_FAILED + conn.Close() return fmt.Errorf("closed") } fsm.bgpMessageStateUpdate(m.Header.Type, false) @@ -1028,6 +1030,7 @@ func (h *FSMHandler) sendMessageloop() error { "Data": m, }).Warn("sent notification") h.errorCh <- FSM_NOTIFICATION_SENT + conn.Close() return fmt.Errorf("closed") } else { log.WithFields(log.Fields{ -- cgit v1.2.3