Skip to content

Commit

Permalink
Merge pull request #143 from donald1218/fix/send-twice-release-uectx
Browse files Browse the repository at this point in the history
fix: release twice uecontext when handover
  • Loading branch information
ianchen0119 authored Sep 18, 2024
2 parents 50a3abc + 1c21d51 commit fbdf75e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
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

0 comments on commit fbdf75e

Please sign in to comment.