From c0bb2bf8000bc3ddc964c279815fc24a3211371d Mon Sep 17 00:00:00 2001 From: donald1218 Date: Mon, 16 Sep 2024 14:41:08 +0000 Subject: [PATCH] fix: rename func and change var name --- internal/gmm/common/user_profile.go | 12 ++++++------ internal/ngap/handler.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/gmm/common/user_profile.go b/internal/gmm/common/user_profile.go index cd2cd7f..3e6165a 100644 --- a/internal/gmm/common/user_profile.go +++ b/internal/gmm/common/user_profile.go @@ -69,18 +69,18 @@ func AttachRanUeToAmfUeAndReleaseOldIfAny(amfUe *context.AmfUe, ranUe *context.R amfUe.AttachRanUe(ranUe) } -func AttachRanUeToAmfUeAndReleaseOldIfHandover(amfUe *context.AmfUe, ranUe *context.RanUe) { - if oldRanUe := amfUe.RanUe[ranUe.Ran.AnType]; oldRanUe != nil { - oldRanUe.DetachAmfUe() +func AttachRanUeToAmfUeAndReleaseOldHandover(amfUe *context.AmfUe, sourceRanUe, targetRanUe *context.RanUe) { + if sourceRanUe != nil { + sourceRanUe.DetachAmfUe() if amfUe.T3550 != nil { - amfUe.State[ranUe.Ran.AnType].Set(context.Registered) + amfUe.State[targetRanUe.Ran.AnType].Set(context.Registered) } StopAll5GSMMTimers(amfUe) causeGroup := ngapType.CausePresentNas causeValue := ngapType.CauseNasPresentNormalRelease - ngap_message.SendUEContextReleaseCommand(oldRanUe, context.UeContextReleaseHandover, causeGroup, causeValue) + ngap_message.SendUEContextReleaseCommand(sourceRanUe, context.UeContextReleaseHandover, causeGroup, causeValue) } - amfUe.AttachRanUe(ranUe) + amfUe.AttachRanUe(targetRanUe) } func ClearHoldingRanUe(ranUe *context.RanUe) { diff --git a/internal/ngap/handler.go b/internal/ngap/handler.go index 3924139..75025f2 100644 --- a/internal/ngap/handler.go +++ b/internal/ngap/handler.go @@ -1212,7 +1212,7 @@ func handleHandoverNotifyMain(ran *context.AmfRan, } } - gmm_common.AttachRanUeToAmfUeAndReleaseOldIfHandover(amfUe, targetUe) + gmm_common.AttachRanUeToAmfUeAndReleaseOldHandover(amfUe, sourceUe, targetUe) } // TODO: The UE initiates Mobility Registration Update procedure as described in clause 4.2.2.2.2.