package sbi
+/*
+#include <time.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <rmr/rmr.h>
+#include <rmr/RIC_message_types.h>
+
+
+#cgo CFLAGS: -I../
+#cgo LDFLAGS: -lrmr_nng -lnng
+*/
+import "C"
+
import (
"errors"
"gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
_ "nanomsg.org/go/mangos/v2/transport/all"
"routing-manager/pkg/rtmgr"
"strconv"
+ "time"
)
type NngPush struct {
Sbi
NewSocket CreateNewNngSocketHandler
+ rcChan chan *xapp.RMRParams
}
func NewNngPush() *NngPush {
xapp.Logger.Debug("Invoked: sbi.DistributeAll")
xapp.Logger.Debug("args: %v", *policies)
for _, ep := range rtmgr.Eps {
- if ep.IsReady {
- go c.send(ep, policies)
- } else {
- xapp.Logger.Warn("Endpoint " + ep.Uuid + " is not ready")
+ i := 1
+ for i < 5 {
+ if ep.IsReady {
+ go c.send(ep, policies)
+ break
+ } else {
+ xapp.Logger.Warn("Endpoint " + ep.Uuid + " is not ready" + " Retry count " + strconv.Itoa(i))
+ time.Sleep(10 * time.Millisecond)
+ i++
+ }
}
}
return nil