diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-29 11:25:29 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2016-01-29 11:38:27 +0900 |
commit | b05da5ddc9c9f78de5883c9dc8f94fa531688085 (patch) | |
tree | 194c77cd46aeaaa54e754f6f989f761194ce4e9a /server/peer.go | |
parent | 0ce9409f1768f5b4a0bc4b3e3e5593ca773056fa (diff) |
server: add negotiated holdtime/keepalive-interval in api struct
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/server/peer.go b/server/peer.go index 8c8f96d4..33621155 100644 --- a/server/peer.go +++ b/server/peer.go @@ -254,25 +254,17 @@ func (peer *Peer) ToApiStruct() *api.Peer { downtime = int64(time.Now().Sub(time.Unix(timer.State.Downtime, 0)).Seconds()) } - keepalive := uint32(0) - if t := timer.State.NegotiatedHoldTime; t != 0 { - if t < timer.Config.HoldTime { - keepalive = uint32(t / 3) - } else { - keepalive = uint32(timer.Config.KeepaliveInterval) - } - } - timerconf := &api.TimersConfig{ - ConnectRetry: uint64(timer.Config.ConnectRetry), - HoldTime: uint64(timer.Config.HoldTime), - KeepaliveInterval: uint64(keepalive), - MinimumAdvertisementInterval: uint64(timer.Config.MinimumAdvertisementInterval), + ConnectRetry: uint64(timer.Config.ConnectRetry), + HoldTime: uint64(timer.Config.HoldTime), + KeepaliveInterval: uint64(timer.Config.KeepaliveInterval), } timerstate := &api.TimersState{ - Uptime: uint64(uptime), - Downtime: uint64(downtime), + KeepaliveInterval: uint64(timer.State.KeepaliveInterval), + NegotiatedHoldTime: uint64(timer.State.NegotiatedHoldTime), + Uptime: uint64(uptime), + Downtime: uint64(downtime), } apitimer := &api.Timers{ |