From e8576de842680c3d14f0ca65841414db166e2232 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 8 Aug 2019 14:50:01 +0200 Subject: [PATCH] SIG: Fix bug with not pushing the changed path to the Session --- go/sig/egress/session/sessmon.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/go/sig/egress/session/sessmon.go b/go/sig/egress/session/sessmon.go index ea9ebd7cc8..09640ef065 100644 --- a/go/sig/egress/session/sessmon.go +++ b/go/sig/egress/session/sessmon.go @@ -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: @@ -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