Always initialize status recorder (#383)

Always initialize the status recorder

Utilize proto methods to get pbFullStatus values.
This commit is contained in:
Maycon Santos
2022-07-07 13:54:47 +02:00
committed by GitHub
parent d4a3ee9d87
commit 7e1b20da5d
2 changed files with 26 additions and 17 deletions

View File

@@ -95,7 +95,9 @@ func (s *Server) Start() error {
s.config = config
s.statusRecorder = nbStatus.NewRecorder()
if s.statusRecorder == nil {
s.statusRecorder = nbStatus.NewRecorder()
}
go func() {
if err := internal.RunClient(ctx, config, s.statusRecorder); err != nil {
@@ -400,6 +402,10 @@ func (s *Server) Status(
statusResponse := proto.StatusResponse{Status: string(status)}
if s.statusRecorder == nil {
s.statusRecorder = nbStatus.NewRecorder()
}
if msg.GetFullPeerStatus {
fullStatus := s.statusRecorder.GetFullStatus()
pbFullStatus := toProtoFullStatus(fullStatus)