-
Notifications
You must be signed in to change notification settings - Fork 100
refactor: use Go context to track UPF association state #122
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
Conversation
Hi @LaumiH Please help to fix the ci-linter error. Thanks. |
Overall, it looks good to me. |
Please review this PR and send the feedback to me in private. |
38a2ab7
to
0a17629
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @LaumiH,
Thanks for the PR, I had rebase to main branch and test the functionality.
They works find and the code is LGTM!
Thanks!
…ontext checks throughout code
cede205
to
4631542
Compare
Sorry for the second force-push, I messed with my git history -.- |
Thanks for your contribution. In addition, Thanks again. |
Right now, a UPF's association state is stored using the
UPFStatus
variable:Whenever necessary, the association state is checked using simple logic:
I think it would be better to make the UPF's association state thread-safe and improve the signaling between different functions by using a
context.Context
.There already is a
Ctx
andCancelFunc
in the UPF struct, but I don't think it is used for signaling so far.Additionally, I suggest to improve the overall use of the
context.Context
Go feature in the code.The
SMFContext
also has aCtx
andPFCPCancelFunc
variable, which are not used for signaling in the code.This PR improves the usage of the
context.Context
concept in Go in multiple parts of the code:UPFStatus
with acontext.Context.Done()
check. The context is calledAssociationContext
and replaces the oldCtx
variable.SMFContext.Ctx
variable more effectively. The context is renamed toSmfPfcpContext
. It is the parent context for theUPF.AssociationContext
.