summaryrefslogtreecommitdiffhomepage
path: root/pkg/server/fsm.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@gmail.com>2019-04-01 20:08:54 +0900
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-04-01 20:08:54 +0900
commit3b36a13bbd1d2c7807d884a4f42e25a3017b38fb (patch)
tree17e39bce30682d6e0cf178ea14005ed6ec87b14c /pkg/server/fsm.go
parent20d3254d3b21a0fcf73418872f7f951316588ad3 (diff)
server: fix passive-mode
passive mode configuration is just ignored. Fixed it to work. Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Diffstat (limited to 'pkg/server/fsm.go')
-rw-r--r--pkg/server/fsm.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/server/fsm.go b/pkg/server/fsm.go
index 5c85c876..a840896f 100644
--- a/pkg/server/fsm.go
+++ b/pkg/server/fsm.go
@@ -593,16 +593,22 @@ func (h *fsmHandler) connectLoop(ctx context.Context, wg *sync.WaitGroup) {
func (h *fsmHandler) active(ctx context.Context) (bgp.FSMState, *fsmStateReason) {
c, cancel := context.WithCancel(ctx)
+ fsm := h.fsm
var wg sync.WaitGroup
- wg.Add(1)
- go h.connectLoop(c, &wg)
+
+ fsm.lock.RLock()
+ tryConnect := !fsm.pConf.Transport.Config.PassiveMode
+ fsm.lock.RUnlock()
+ if tryConnect {
+ wg.Add(1)
+ go h.connectLoop(c, &wg)
+ }
defer func() {
cancel()
wg.Wait()
}()
- fsm := h.fsm
for {
select {
case <-ctx.Done():