Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: release twice uecontext when handover #143

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions internal/gmm/common/user_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,25 @@ func AttachRanUeToAmfUeAndReleaseOldIfAny(amfUe *context.AmfUe, ranUe *context.R
amfUe.AttachRanUe(ranUe)
}

func AttachRanUeToAmfUeAndReleaseOldHandover(amfUe *context.AmfUe, sourceRanUe, targetRanUe *context.RanUe) {
logger.GmmLog.Debugln("In AttachRanUeToAmfUeAndReleaseOldHandover")

if sourceRanUe != nil {
sourceRanUe.DetachAmfUe()
if amfUe.T3550 != nil {
amfUe.State[targetRanUe.Ran.AnType].Set(context.Registered)
}
StopAll5GSMMTimers(amfUe)
causeGroup := ngapType.CausePresentRadioNetwork
causeValue := ngapType.CauseRadioNetworkPresentSuccessfulHandover
ngap_message.SendUEContextReleaseCommand(sourceRanUe, context.UeContextReleaseHandover, causeGroup, causeValue)
} else {
// This function will be call only by N2 Handover, so we can assume sourceRanUe will not be nil
logger.GmmLog.Errorln("AttachRanUeToAmfUeAndReleaseOldHandover() is called but sourceRanUe is nil")
}
amfUe.AttachRanUe(targetRanUe)
}

func ClearHoldingRanUe(ranUe *context.RanUe) {
if ranUe != nil {
ranUe.DetachAmfUe()
Expand Down
4 changes: 1 addition & 3 deletions internal/ngap/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1211,10 +1211,8 @@ func handleHandoverNotifyMain(ran *context.AmfRan,
ran.Log.Errorf("Send UpdateSmContextN2HandoverComplete Error[%s]", err.Error())
}
}
gmm_common.AttachRanUeToAmfUeAndReleaseOldIfAny(amfUe, targetUe)

ngap_message.SendUEContextReleaseCommand(sourceUe, context.UeContextReleaseHandover, ngapType.CausePresentNas,
ngapType.CauseNasPresentNormalRelease)
gmm_common.AttachRanUeToAmfUeAndReleaseOldHandover(amfUe, sourceUe, targetUe)
}

// TODO: The UE initiates Mobility Registration Update procedure as described in clause 4.2.2.2.2.
Expand Down
Loading