summaryrefslogtreecommitdiffhomepage
path: root/config/default.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-11-23 23:31:04 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-11-25 10:56:27 +0900
commitf08b355930c6d18ac184b82c44858d0c10bded92 (patch)
tree079e98fee7076e2a3842cf7e0a441313d906c023 /config/default.go
parent43bc69987edfd0738c4fa1859caeb1060877081d (diff)
config: add helper function to set defalut values
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'config/default.go')
-rw-r--r--config/default.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/config/default.go b/config/default.go
new file mode 100644
index 00000000..1b9b59c5
--- /dev/null
+++ b/config/default.go
@@ -0,0 +1,18 @@
+package config
+
+const (
+ DEFAULT_HOLDTIME = 90
+)
+
+func setTimersTypeDefault(timersT *TimersType) {
+ if timersT.HoldTime == 0 {
+ timersT.HoldTime = float64(DEFAULT_HOLDTIME)
+ }
+ if timersT.KeepaliveInterval == 0 {
+ timersT.KeepaliveInterval = timersT.HoldTime / 3
+ }
+}
+
+func SetNeighborTypeDefault(neighborT *NeighborType) {
+ setTimersTypeDefault(&neighborT.Timers)
+}