Skip to content

Commit

Permalink
fix init.go
Browse files Browse the repository at this point in the history
  • Loading branch information
KunLee76 committed Jun 12, 2024
1 parent 1fe3a69 commit 8aa6f48
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ func action(cliCtx *cli.Context) error {
logger.MainLog.Warnln("Terminating... (Wait 2s for other NFs to deregister)")
time.Sleep(2 * time.Second) // Waiting for other NFs to deregister
cancel() // Notify each goroutine and wait them stopped
if NRF != nil {
NRF.WaitRoutineStopped()
}
}()

defer func() {
Expand All @@ -87,7 +84,9 @@ func action(cliCtx *cli.Context) error {
NRF = nrf

nrf.Start(tlsKeyLogPath)

if NRF != nil {
NRF.WaitRoutineStopped()
}
return nil
}

Expand Down
5 changes: 0 additions & 5 deletions internal/sbi/api_accesstoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import (
"github.com/free5gc/openapi/models"
)

// Index is the index handler.
func Index(c *gin.Context) {
c.String(http.StatusOK, "StatusOK")
}

func (s *Server) getAccessTokenRoutes() []Route {
return []Route{
{
Expand Down
7 changes: 6 additions & 1 deletion pkg/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ func NewApp(ctx context.Context, cfg *factory.Config, tlsKeyLogPath string) (*Nr
nrf.SetLogEnable(cfg.GetLogEnable())
nrf.SetLogLevel(cfg.GetLogLevel())
nrf.SetReportCaller(cfg.GetLogReportCaller())

err1 := nrf_context.InitNrfContext()
if err1 != nil {
return nrf, err1
}
p, err := processor.NewProcessor(nrf)
if err != nil {
return nrf, err
}
nrf.processor = p

nrf.ctx, nrf.cancel = context.WithCancel(ctx)
nrf.nrfCtx = nrf_context.GetSelf()
if nrf.sbiServer, err = sbi.NewServer(nrf, tlsKeyLogPath); err != nil {
return nil, err
Expand Down Expand Up @@ -145,5 +151,4 @@ func (a *NrfApp) WaitRoutineStopped() {

func (a *NrfApp) Stop() {
a.cancel()
a.WaitRoutineStopped()
}

0 comments on commit 8aa6f48

Please sign in to comment.