Skip to content

Commit

Permalink
refactor: make PFCP context child of app context
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura Henning committed Sep 23, 2024
1 parent 2e2d424 commit 22faf01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func action(cliCtx *cli.Context) error {
}
factory.UERoutingConfig = ueRoutingCfg

pfcpStart, pfcpTerminate := utils.InitPFCPFunc()
pfcpStart, pfcpTerminate := utils.InitPFCPFunc(ctx)
smf, err := service.NewApp(ctx, cfg, tlsKeyLogPath, pfcpStart, pfcpTerminate)
if err != nil {
sigCh <- nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/pfcp_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"github.com/free5gc/smf/pkg/service"
)

func InitPFCPFunc() (func(a *service.SmfApp), func()) {
func InitPFCPFunc(pCtx context.Context) (func(a *service.SmfApp), func()) {
smfContext := smf_context.GetSelf()

pfcpStart := func(a *service.SmfApp) {
// Initialize PFCP server
smfContext.PfcpContext, smfContext.PfcpCancelFunc = context.WithCancel(context.Background())
smfContext.PfcpContext, smfContext.PfcpCancelFunc = context.WithCancel(pCtx)

udp.Run(pfcp.Dispatch)

Expand Down

0 comments on commit 22faf01

Please sign in to comment.