From 8f403db78545d99462cf56b41f852a0f6fceeff5 Mon Sep 17 00:00:00 2001 From: karampok Date: Fri, 15 Nov 2019 13:26:10 +0100 Subject: [PATCH] Change default normalRefire duration in pathmgr --- go/lib/pathmgr/pathmgr.go | 2 +- go/lib/snet/snet.go | 8 +------- go/sig/sigcmn/BUILD.bazel | 1 + go/sig/sigcmn/common.go | 8 ++++---- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/go/lib/pathmgr/pathmgr.go b/go/lib/pathmgr/pathmgr.go index a1144a2a2c..29b128569d 100644 --- a/go/lib/pathmgr/pathmgr.go +++ b/go/lib/pathmgr/pathmgr.go @@ -70,7 +70,7 @@ func (timers *Timers) GetWait(isError bool) time.Duration { const ( // DefaultNormalRefire is the wait time after a successful path lookup (for periodic lookups) - DefaultNormalRefire = time.Minute + DefaultNormalRefire = 10 * time.Second // DefaultErorrRefire is the wait time after a failed path lookup (for periodic lookups) DefaultErrorRefire = time.Second // DefaultQueryTimeout is the time allocated for a query to SCIOND diff --git a/go/lib/snet/snet.go b/go/lib/snet/snet.go index 20bb1d06a5..5d56dfbcf7 100644 --- a/go/lib/snet/snet.go +++ b/go/lib/snet/snet.go @@ -138,13 +138,7 @@ func getResolver(sciondPath string) (pathmgr.Resolver, error) { if err != nil { return nil, common.NewBasicError("Unable to initialize SCIOND service", err) } - pathResolver = pathmgr.New( - sciondConn, - pathmgr.Timers{ - NormalRefire: time.Minute, - ErrorRefire: 3 * time.Second, - }, - ) + pathResolver = pathmgr.New(sciondConn, pathmgr.Timers{}) } return pathResolver, nil } diff --git a/go/sig/sigcmn/BUILD.bazel b/go/sig/sigcmn/BUILD.bazel index 333794d632..1cc07ea7cf 100644 --- a/go/sig/sigcmn/BUILD.bazel +++ b/go/sig/sigcmn/BUILD.bazel @@ -9,6 +9,7 @@ go_library( "//go/lib/addr:go_default_library", "//go/lib/common:go_default_library", "//go/lib/env:go_default_library", + "//go/lib/log:go_default_library", "//go/lib/pathmgr:go_default_library", "//go/lib/snet:go_default_library", "//go/lib/sock/reliable:go_default_library", diff --git a/go/sig/sigcmn/common.go b/go/sig/sigcmn/common.go index 22ae715ec3..aea8bda74b 100644 --- a/go/sig/sigcmn/common.go +++ b/go/sig/sigcmn/common.go @@ -22,6 +22,7 @@ import ( "github.com/scionproto/scion/go/lib/addr" "github.com/scionproto/scion/go/lib/common" "github.com/scionproto/scion/go/lib/env" + "github.com/scionproto/scion/go/lib/log" "github.com/scionproto/scion/go/lib/pathmgr" "github.com/scionproto/scion/go/lib/snet" "github.com/scionproto/scion/go/lib/sock/reliable" @@ -57,7 +58,6 @@ func Init(cfg sigconfig.SigConf, sdCfg env.SciondClient) error { encapPort = cfg.EncapPort ds := reliable.NewDispatcherService(cfg.Dispatcher) - // TODO(karampok). To be kept until https://github.com/scionproto/scion/issues/3377 wait := func() (*snet.SCIONNetwork, error) { deadline := time.Now().Add(sdCfg.InitialConnectPeriod.Duration) @@ -65,14 +65,14 @@ func Init(cfg sigconfig.SigConf, sdCfg env.SciondClient) error { for tries := 0; time.Now().Before(deadline); tries++ { n, err := snet.NewNetwork(cfg.IA, sdCfg.Path, ds) if err == nil { - return n, nil // success + return n, nil } + log.Debug("SIG is retrying to get NewNetwork", err) retErr = err - time.Sleep(time.Second << uint(tries)) // exponential back-off + time.Sleep(time.Second) } return nil, retErr } - network, err := wait() if err != nil { return common.NewBasicError("Error creating local SCION Network context", err)