Skip to content

Commit

Permalink
fix: instantiate processor in NewApp()
Browse files Browse the repository at this point in the history
  • Loading branch information
yccodr committed Jun 4, 2024
1 parent f0b8da4 commit 277815f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
14 changes: 10 additions & 4 deletions internal/sbi/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@ import (
logger_util "github.com/free5gc/util/logger"
)

type Server struct {
type nssfApp interface {
app.NssfApp

Processor() *processor.Processor
}

type Server struct {
nssfApp

httpServer *http.Server
router *gin.Engine
processor *processor.Processor
}

func NewServer(nssf app.NssfApp, tlsKeyLogPath string) *Server {
func NewServer(nssf nssfApp, tlsKeyLogPath string) *Server {
s := &Server{
NssfApp: nssf,
processor: processor.NewProcessor(nssf),
nssfApp: nssf,
processor: nssf.Processor(),
}

s.router = newRouter(s)
Expand Down
3 changes: 3 additions & 0 deletions pkg/service/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func NewApp(cfg *factory.Config, tlsKeyLogPath string) (*NssfApp, error) {
nssf.SetLogLevel(cfg.GetLogLevel())
nssf.SetReportCaller(cfg.GetLogReportCaller())

processor := processor.NewProcessor(nssf)
nssf.processor = processor

consumer := consumer.NewConsumer(nssf)
nssf.consumer = consumer

Expand Down

0 comments on commit 277815f

Please sign in to comment.