Skip to content

Commit

Permalink
remove a condition in scavenger
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Dec 19, 2020
1 parent 9ac04cd commit e9316f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/main.go
Expand Up @@ -439,7 +439,7 @@ func main() {
for k := range muxes {
muxes[k].session = waitConn()
muxes[k].expiryDate = time.Now().Add(time.Duration(config.AutoExpire) * time.Second)
if config.AutoExpire > 0 {
if config.AutoExpire > 0 { // only when autoexpire set
chScavenger <- muxes[k].session
}
}
Expand All @@ -456,7 +456,7 @@ func main() {
if muxes[idx].session.IsClosed() || (config.AutoExpire > 0 && time.Now().After(muxes[idx].expiryDate)) {
muxes[idx].session = waitConn()
muxes[idx].expiryDate = time.Now().Add(time.Duration(config.AutoExpire) * time.Second)
if config.AutoExpire > 0 {
if config.AutoExpire > 0 { // only when autoexpire set
chScavenger <- muxes[idx].session
}
}
Expand Down Expand Up @@ -484,7 +484,7 @@ func scavenger(ch chan *smux.Session, config *Config) {
s := sessionList[k]
if s.session.IsClosed() {
log.Println("session normally closed", s.session.RemoteAddr())
} else if config.AutoExpire > 0 && time.Now().After(s.expiryDate) {
} else if time.Now().After(s.expiryDate) {
log.Println("session reached scavenge ttl", s.session.RemoteAddr())
s.session.Close()
} else {
Expand Down

0 comments on commit e9316f7

Please sign in to comment.