Skip to content

Commit

Permalink
chore: decreasing SessionTimeout to 10 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
b00f committed May 25, 2023
1 parent 3d9b7f0 commit 636c535
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions config/example_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
## heartbeat_timer = "5s"

# `session_timeout` is a timeout for a session to be opened.
# Default is 30 seconds
## session_timeout = "30s"
# Default is 10 seconds
## session_timeout = "10s"

# `max_open_sessions` is the maximum number of open sessions.
# Default is 8
Expand Down
2 changes: 1 addition & 1 deletion sync/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Config struct {
func DefaultConfig() *Config {
return &Config{
HeartBeatTimer: time.Second * 5,
SessionTimeout: time.Second * 30,
SessionTimeout: time.Second * 10,
NodeNetwork: true,
BlockPerMessage: 60,
MaxOpenSessions: 8,
Expand Down
9 changes: 0 additions & 9 deletions sync/peerset/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ func (p *Peer) IsBanned() bool {
return p.Status == StatusCodeBanned
}

// TODO: why setter here???
func (p *Peer) SetNodeNetworkFlag(nodeNetwork bool) {
if nodeNetwork {
p.Flags = util.SetFlag(p.Flags, PeerFlagNodeNetwork)
} else {
p.Flags = util.UnsetFlag(p.Flags, PeerFlagNodeNetwork)
}
}

func (p *Peer) IsNodeNetwork() bool {
return util.IsFlagSet(p.Flags, PeerFlagNodeNetwork)
}
6 changes: 5 additions & 1 deletion sync/peerset/peer_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ func (ps *PeerSet) UpdatePeerInfo(
p.Agent = agent
p.ConsensusKeys[*consKey] = true

p.SetNodeNetworkFlag(nodeNetwork)
if nodeNetwork {
p.Flags = util.SetFlag(p.Flags, PeerFlagNodeNetwork)
} else {
p.Flags = util.UnsetFlag(p.Flags, PeerFlagNodeNetwork)
}
}

func (ps *PeerSet) UpdateHeight(pid peer.ID, height uint32) {
Expand Down

0 comments on commit 636c535

Please sign in to comment.