Skip to content

Commit

Permalink
SIG: Fix bug with not pushing the changed path to the Session (#2977)
Browse files Browse the repository at this point in the history
  • Loading branch information
sustrik authored Aug 9, 2019
1 parent 97efff4 commit f08ed80
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions go/sig/egress/session/sessmon.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ Top:
case <-sm.sess.sessMonStop:
break Top
case <-reqTick.C:
// Update paths and sigs
sm.sessPathPool.Update(sm.pool.Paths())
sm.updatePaths()
sm.updateRemote()
sm.sendReq()
case rpld := <-regc:
Expand All @@ -113,6 +112,27 @@ Top:
sm.Info("sessMonitor: stopped")
}

func (sm *sessMonitor) updatePaths() {
if sm.smRemote == nil || sm.smRemote.SessPath == nil {
sm.sessPathPool.Update(sm.pool.Paths())
return
}
currPath := sm.smRemote.SessPath
expTime := currPath.PathEntry().Path.ExpTime
mtu := currPath.PathEntry().Path.Mtu
sm.sessPathPool.Update(sm.pool.Paths())
// Expiration or MTU of the current path may have changed during the update.
// In such a case we want to push the updated path to the Session.
if currPath.PathEntry().Path.ExpTime != expTime || currPath.PathEntry().Path.Mtu != mtu {
sm.Trace("sessMonitor: Path metadata changed",
"oldExpiration", expTime,
"newExpiration", currPath.PathEntry().Path.ExpTime,
"oldMTU", mtu,
"newMTU", currPath.PathEntry().Path.Mtu)
sm.updateSessSnap()
}
}

func (sm *sessMonitor) updateRemote() {
// There were no replies from the remote SIG for some time. We don't know whether
// the failure was caused by bad path or bad SIG. Therefore, we choose a different
Expand Down

0 comments on commit f08ed80

Please sign in to comment.