summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-02-25 08:52:49 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-02-25 08:52:49 +0900
commit12af62f25e35a85db5c319ea518d947f3d2d1783 (patch)
tree5234190efedd104a48d86dd03c173bf407e88481 /server
parent2c0eddfb9ddbaacf8fdea69d191b7c5857abd938 (diff)
server: handle closed passiveConnCh channel
When a peer is deleted, passiveConnCh is closed implicitly. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/fsm.go25
1 files changed, 20 insertions, 5 deletions
diff --git a/server/fsm.go b/server/fsm.go
index 26f7b830..bac2a956 100644
--- a/server/fsm.go
+++ b/server/fsm.go
@@ -211,7 +211,10 @@ func (h *FSMHandler) idle() bgp.FSMState {
select {
case <-h.t.Dying():
return 0
- case conn := <-fsm.passiveConnCh:
+ case conn, ok := <-fsm.passiveConnCh:
+ if !ok {
+ break
+ }
conn.Close()
log.WithFields(log.Fields{
"Topic": "Peer",
@@ -255,7 +258,10 @@ func (h *FSMHandler) active() bgp.FSMState {
select {
case <-h.t.Dying():
return 0
- case conn := <-fsm.passiveConnCh:
+ case conn, ok := <-fsm.passiveConnCh:
+ if !ok {
+ break
+ }
fsm.passiveConn = conn
// we don't implement delayed open timer so move to opensent right
// away.
@@ -407,7 +413,10 @@ func (h *FSMHandler) opensent() bgp.FSMState {
case <-h.t.Dying():
h.conn.Close()
return 0
- case conn := <-fsm.passiveConnCh:
+ case conn, ok := <-fsm.passiveConnCh:
+ if !ok {
+ break
+ }
conn.Close()
log.WithFields(log.Fields{
"Topic": "Peer",
@@ -502,7 +511,10 @@ func (h *FSMHandler) openconfirm() bgp.FSMState {
case <-h.t.Dying():
h.conn.Close()
return 0
- case conn := <-fsm.passiveConnCh:
+ case conn, ok := <-fsm.passiveConnCh:
+ if !ok {
+ break
+ }
conn.Close()
log.WithFields(log.Fields{
"Topic": "Peer",
@@ -644,7 +656,10 @@ func (h *FSMHandler) established() bgp.FSMState {
select {
case <-h.t.Dying():
return 0
- case conn := <-fsm.passiveConnCh:
+ case conn, ok := <-fsm.passiveConnCh:
+ if !ok {
+ break
+ }
conn.Close()
log.WithFields(log.Fields{
"Topic": "Peer",