+
+ trans := subs.GetTransaction()
+ if trans == nil {
+ xapp.Logger.Error("SubReq timeout: Unknown trans. Dropping this msg. SubId: %v", subs.GetSubId())
+ return
+ }
+
+ responseReceived := trans.CheckResponseReceived()
+
+ if responseReceived == true {
+ // Subscription Response or Failure already received
+ return
+ }
+
+ if tryCount < maxSubReqTryCount {
+ xapp.Logger.Info("SubReq timeout: subs: %s trans: %s", subs, trans)
+
+ trans.RetryTransaction()
+
+ c.rmrSend("SubReq timeout: SubReq to E2T", subs, trans)
+
+ tryCount++
+ c.timerMap.StartTimer("RIC_SUB_REQ", int(subs.GetSubId()), subReqTime, tryCount, c.handleSubscriptionRequestTimer)
+ return
+ }
+
+ // Release CREATE transaction
+ trans.Release()
+
+ // Create DELETE transaction (internal and no messages toward xapp)
+ deltrans, err := c.tracker.TrackTransaction(&trans.RmrEndpoint,
+ trans.GetXid(),
+ trans.GetMeid(),
+ false,
+ false)
+
+ if err != nil {
+ xapp.Logger.Error("SubReq timeout: %s, Dropping this msg.", err.Error())
+ //TODO improve error handling. Important at least in merge
+ subs.Release()
+ return
+ }
+
+ deltrans.SubDelReqMsg = &e2ap.E2APSubscriptionDeleteRequest{}
+ deltrans.SubDelReqMsg.RequestId.Id = trans.SubReqMsg.RequestId.Id
+ deltrans.SubDelReqMsg.RequestId.Seq = uint32(subs.GetSubId())
+ deltrans.SubDelReqMsg.FunctionId = trans.SubReqMsg.FunctionId
+ deltrans.Mtype, deltrans.Payload, err = c.e2ap.PackSubscriptionDeleteRequest(deltrans.SubDelReqMsg)
+ if err != nil {
+ xapp.Logger.Error("SubReq timeout: Packing SubDelReq failed. Err: %v", err)
+ //TODO improve error handling. Important at least in merge
+ deltrans.Release()
+ subs.Release()
+ return
+ }
+
+ err = subs.SetTransaction(deltrans)
+ if err != nil {
+ xapp.Logger.Error("SubReq timeout: %s, Dropping this msg.", err.Error())
+ //TODO improve error handling. Important at least in merge
+ deltrans.Release()
+ return
+ }
+
+ c.rmrSend("SubReq timer: SubDelReq to E2T", subs, deltrans)
+ c.timerMap.StartTimer("RIC_SUB_DEL_REQ", int(subs.GetSubId()), subDelReqTime, FirstTry, c.handleSubscriptionDeleteRequestTimer)
+ return