var rmrcallid = 1
var rmrdynamiccallid = 201
var addendpointct = 1
-
-var conn sync.Mutex
+var count int
+var Conn sync.Mutex
type RmrPush struct {
Sbi
time.Sleep(time.Duration(10) * time.Second)
ep.Whid = int(xapp.Rmr.Openwh(endpoint))
if ep.Whid < 0 {
- return errors.New("can't open warmhole connection for endpoint:" + ep.Uuid + " due to invalid Wormhole ID: " + string(ep.Whid) + " count: " + strconv.Itoa(count))
+ return errors.New("cannot open wormhole connection for endpoint:" + ep.Uuid + " due to invalid Wormhole ID: " + string(ep.Whid) + " count: " + strconv.Itoa(count))
}
} else {
xapp.Logger.Debug("Wormhole ID is %v and EP is %v", ep.Whid, endpoint)
if result[i].status == true {
count++
} else {
- xapp.Logger.Error("RMR send failed for endpoint %v", result[i].endpoint)
+ xapp.Logger.Error("RMR sent failed for endpoint %v", result[i].endpoint)
}
}
xapp.Logger.Debug("Push policy to endpoint: " + ep.Uuid)
ret := c.send_data(ep, policies, call_id)
- conn.Lock()
+ for count = 0; count <= 2 && ret == false; count++ {
+ time.Sleep(time.Second)
+ ret := c.send_data(ep, policies, call_id)
+ if ret == true {
+ break
+ }
+ xapp.Logger.Error("Invoked send_data to try again due to return value : %v", ret)
+ }
+
+ Conn.Lock()
rtmgr.RMRConnStatus[ep.Uuid] = ret
- conn.Unlock()
+ Conn.Unlock()
// Handling per connection .. may be updating global map
//channel <- EPStatus{ep.Uuid, ret}