+
+func (c *Control) handleSubscriptionDeleteRequestTimer(strId string, nbrId int, tryCount uint64) {
+ xapp.Logger.Info("SubDelReq timeout: subId: %v, tryCount: %v", nbrId, tryCount)
+
+ subs := c.registry.GetSubscription(uint16(nbrId))
+ if subs == nil {
+ xapp.Logger.Error("SubDelReq timeout: Unknown payloadSeqNum. Dropping this msg. SubId: %v", nbrId)
+ return
+ }
+
+ trans := subs.GetTransaction()
+ if trans == nil {
+ xapp.Logger.Error("SubDelReq timeout: Unknown trans. Dropping this msg. SubId: %v", subs.GetSubId())
+ return
+ }
+
+ responseReceived := trans.CheckResponseReceived()
+ if responseReceived == true {
+ // Subscription Delete Response or Failure already received
+ return
+ }
+
+ if tryCount < maxSubDelReqTryCount {
+ // Set possible to handle new response for the subId
+ trans.RetryTransaction()
+ c.rmrSend("SubDelReq timeout: SubDelReq to E2T", subs, trans)
+ tryCount++
+ c.timerMap.StartTimer("RIC_SUB_DEL_REQ", int(subs.GetSubId()), subReqTime, tryCount, c.handleSubscriptionDeleteRequestTimer)
+ return
+ }
+
+ c.sendSubscriptionDeleteResponse("SubDelReq(timer)", trans, subs)
+ return
+}
+
+func (c *Control) sendSubscriptionDeleteResponse(desc string, trans *Transaction, subs *Subscription) {
+
+ if trans.ForwardRespToXapp == true {
+ //Always generate SubDelResp
+ trans.SubDelRespMsg = &e2ap.E2APSubscriptionDeleteResponse{}
+ trans.SubDelRespMsg.RequestId.Id = trans.SubDelReqMsg.RequestId.Id
+ trans.SubDelRespMsg.RequestId.Seq = uint32(subs.GetSubId())
+ trans.SubDelRespMsg.FunctionId = trans.SubDelReqMsg.FunctionId
+
+ var err error
+ trans.Mtype, trans.Payload, err = c.e2ap.PackSubscriptionDeleteResponse(trans.SubDelRespMsg)
+ if err == nil {
+ c.rmrReplyToSender(desc+": SubDelResp to xapp", subs, trans)
+ time.Sleep(3 * time.Second)
+ } else {
+ //TODO error handling improvement
+ xapp.Logger.Error("%s: %s for trans %s (continuing cleaning)", desc, err.Error(), trans)
+ }
+ }
+
+ trans.Release()
+ subs.Release()
+}