+func (c *Control) handleSubscriptionDeleteRequest(params *RMRParams) {
+ xapp.Logger.Info("SubDelReq from xapp: %s", params.String())
+
+ SubDelReqMsg, err := c.e2ap.UnpackSubscriptionDeleteRequest(params.Payload)
+ if err != nil {
+ xapp.Logger.Error("SubDelReq Drop %s", idstring(params, nil, err))
+ return
+ }
+
+ trans, err := c.tracker.TrackTransaction(NewRmrEndpoint(params.Src), params.Xid, params.Meid, false, true)
+ if err != nil {
+ xapp.Logger.Error("SubDelReq Drop %s", idstring(params, nil, err))
+ return
+ }
+ trans.SubDelReqMsg = SubDelReqMsg
+
+ subs, err := c.findSubs([]int{int(trans.SubDelReqMsg.RequestId.Seq), params.SubId})
+ if err != nil {
+ xapp.Logger.Error("SubDelReq: %s", idstring(params, nil, err))
+ trans.Release()
+ return
+ }
+
+ err = subs.SetTransaction(trans)
+ if err != nil {
+ xapp.Logger.Error("SubDelReq: %s", idstring(trans, subs, err))
+ trans.Release()
+ return
+ }
+
+ xapp.Logger.Debug("SubDelReq: Handling %s", idstring(trans, subs, nil))
+
+ //
+ // TODO: subscription delete is in fact owned by subscription and not transaction.
+ // Transaction is toward xapp while Subscription is toward ran.
+ // In merge several xapps may wake transactions, while only one subscription
+ // toward ran occurs -> subscription owns subscription creation toward ran
+ //
+ // This is intermediate solution while improving message handling
+ //
+ trans.Mtype, trans.Payload, err = c.e2ap.PackSubscriptionDeleteRequest(trans.SubDelReqMsg)
+ if err != nil {
+ xapp.Logger.Error("SubDelReq: %s", idstring(trans, subs, err))
+ trans.Release()
+ return