Skip to content

Commit

Permalink
Change default normalRefire duration in pathmgr (#3387)
Browse files Browse the repository at this point in the history
  • Loading branch information
karampok authored Nov 15, 2019
1 parent 9a26911 commit abcac30
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go/lib/pathmgr/pathmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 1 addition & 7 deletions go/lib/snet/snet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions go/sig/sigcmn/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions go/sig/sigcmn/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -57,22 +58,21 @@ 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)
var retErr 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)
Expand Down

0 comments on commit abcac30

Please sign in to comment.