summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-03-14 23:54:34 -0700
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-03-15 00:02:59 -0700
commit4c4bc4670cbae44696e3ddb14d56445dcacb59a8 (patch)
treeb3f413e418ac1137894c529b6516df62403097d9
parent483fc497aca18cd6572f6ae12f0d52486d17e3cd (diff)
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
-rw-r--r--server/fsm.go3
1 files changed, 3 insertions, 0 deletions
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{