summaryrefslogtreecommitdiffhomepage
path: root/server/fsm_test.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-13 12:49:17 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-14 21:13:09 +0900
commit72d1fc4cedd233861df725a9eac5f18022f92125 (patch)
tree75843a9609fd77acef784d535b419e3e6bcf15d6 /server/fsm_test.go
parent16aec4acef8f580b7b1b62abedc6365c176feb3f (diff)
server: fix fsm.keepaliveTicker race
When fsm state goes to idle from established, fsm.keepaliveTicker is set to nil. This can happen before <-h.t.Dying() case in sendMessageloop(). This removes fsm.keepaliveTicker. Ticker is created locally. With this, a keepalive message could be sent from openconfirm to established with a shorter interval. But it should not break anything. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/fsm_test.go')
-rw-r--r--server/fsm_test.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/server/fsm_test.go b/server/fsm_test.go
index 6f18014d..ff758253 100644
--- a/server/fsm_test.go
+++ b/server/fsm_test.go
@@ -163,9 +163,8 @@ func TestFSMHandlerOpensent_HoldTimerExpired(t *testing.T) {
// push mock connection
p.fsm.conn = m
- // set up keepalive ticker
- sec := time.Second * 1
- p.fsm.keepaliveTicker = time.NewTicker(sec)
+ // set keepalive ticker
+ p.fsm.negotiatedHoldTime = 3
// set holdtime
p.fsm.opensentHoldTime = 2
@@ -213,9 +212,8 @@ func TestFSMHandlerEstablish_HoldTimerExpired(t *testing.T) {
// push mock connection
p.fsm.conn = m
- // set up keepalive ticker
- sec := time.Second * 1
- p.fsm.keepaliveTicker = time.NewTicker(sec)
+ // set keepalive ticker
+ p.fsm.negotiatedHoldTime = 3
msg := keepalive()
header, _ := msg.Header.Serialize()
@@ -273,10 +271,8 @@ func TestFSMHandlerEstablished_HoldtimeZero(t *testing.T) {
// push mock connection
p.fsm.conn = m
- // set up keepalive ticker
- sec := time.Second * 1
- p.fsm.keepaliveTicker = time.NewTicker(sec)
- p.fsm.keepaliveTicker.Stop()
+ // set keepalive ticker
+ p.fsm.negotiatedHoldTime = 3
// set holdtime
p.fsm.negotiatedHoldTime = 0