diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-13 04:30:55 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-01-13 05:06:24 -0800 |
commit | 3f0fc3ccc9709b070c6424e0be33e53a8a407fe3 (patch) | |
tree | 51f5f8de526d6ab26ca3940f564c535b4d42d661 /server | |
parent | deca8a50043cd5f0cc8ee576ac60df141fce3b1c (diff) |
server: fix fixed timeout for write
using 30 secs is a bad idea. Let's use negotiated holdtime
instead. But I think that we should not use timeout for write. when a
timeout for write expires, we shuld just check:
a) if the conneciton is still valid
b) a peer is not de-configured
a) nor b) is not the case, we should try write again.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r-- | server/fsm.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/server/fsm.go b/server/fsm.go index d853592d..25aefaa2 100644 --- a/server/fsm.go +++ b/server/fsm.go @@ -827,7 +827,7 @@ func (h *FSMHandler) sendMessageloop() error { fsm.bgpMessageStateUpdate(0, false) return nil } - if err := conn.SetWriteDeadline(time.Now().Add(time.Second * 30)); err != nil { + if err := conn.SetWriteDeadline(time.Now().Add(time.Second * time.Duration(fsm.negotiatedHoldTime))); err != nil { h.errorCh <- true conn.Close() return fmt.Errorf("failed to set write deadline") |