diff --git a/cmd/main.go b/cmd/main.go index 74fb5ce1..db97fcb7 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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 diff --git a/pkg/utils/pfcp_util.go b/pkg/utils/pfcp_util.go index 01719b92..761ade7e 100644 --- a/pkg/utils/pfcp_util.go +++ b/pkg/utils/pfcp_util.go @@ -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)