Fix for Submgr crash problem 61/6661/1
authorAnssi Mannila <anssi.mannila@nokia.com>
Mon, 13 Sep 2021 08:36:13 +0000 (11:36 +0300)
committerAnssi Mannila <anssi.mannila@nokia.com>
Mon, 13 Sep 2021 08:45:19 +0000 (11:45 +0300)
 - Submgr crashed when xApp was restarted after Submgr restart
 - There was an uninitialised pointer after Submgr restart
 - Storing REST subscriptions to SDL did not worked properly

Change-Id: I7dc55841cffc9a0fe56cad0db49f97c256c0e216
Signed-off-by: Anssi Mannila <anssi.mannila@nokia.com>
pkg/control/control.go
pkg/control/sdl_restSubsDb.go

index e4b5820..3ebcbcd 100755 (executable)
@@ -142,25 +142,6 @@ func NewControl() *Control {
        // Read subscriptions from db
        c.ReadE2Subscriptions()
        c.ReadRESTSubscriptions()
-
-       /*
-               xapp.Logger.Info("Reading subscriptions from db")
-               subIds, register, err := c.ReadAllSubscriptionsFromSdl()
-               if err != nil {
-                       xapp.Logger.Error("%v", err)
-               } else {
-                       c.registry.subIds = subIds
-                       c.registry.register = register
-                       c.HandleUncompletedSubscriptions(register)
-               }
-
-               restSubscriptions, err := c.ReadAllRESTSubscriptionsFromSdl()
-               if err != nil {
-                       xapp.Logger.Error("%v", err)
-               } else {
-                       c.registry.restSubscriptions = restSubscriptions
-               }
-       */
        return c
 }
 
index 1c46856..f9d837b 100644 (file)
@@ -28,10 +28,10 @@ import (
 )
 
 type RESTSubscriptionInfo struct {
-       xAppRmrEndPoint  string
+       XAppRmrEndPoint  string
        Meid             string
        InstanceIds      []uint32
-       xAppIdToE2Id     map[int64]int64
+       XAppIdToE2Id     map[int64]int64
        SubReqOngoing    bool
        SubDelReqOngoing bool
        Md5sum           string
@@ -44,10 +44,10 @@ func CreateRESTSdl() Sdlnterface {
 func (c *Control) WriteRESTSubscriptionToSdl(restSubId string, restSubs *RESTSubscription) error {
 
        var restSubscriptionInfo RESTSubscriptionInfo
-       restSubscriptionInfo.xAppRmrEndPoint = restSubs.xAppRmrEndPoint
+       restSubscriptionInfo.XAppRmrEndPoint = restSubs.xAppRmrEndPoint
        restSubscriptionInfo.Meid = restSubs.Meid
        restSubscriptionInfo.InstanceIds = restSubs.InstanceIds
-       restSubscriptionInfo.xAppIdToE2Id = restSubs.xAppIdToE2Id
+       restSubscriptionInfo.XAppIdToE2Id = restSubs.xAppIdToE2Id
        restSubscriptionInfo.SubReqOngoing = restSubs.SubReqOngoing
        restSubscriptionInfo.SubDelReqOngoing = restSubs.SubDelReqOngoing
        restSubscriptionInfo.Md5sum = restSubs.lastReqMd5sum
@@ -102,10 +102,10 @@ func (c *Control) ReadRESTSubscriptionFromSdl(restSubId string) (*RESTSubscripti
 func (c *Control) CreateRESTSubscription(restSubscriptionInfo *RESTSubscriptionInfo, jsonSubscriptionInfo *string) *RESTSubscription {
 
        restSubs := &RESTSubscription{}
-       restSubs.xAppRmrEndPoint = restSubscriptionInfo.xAppRmrEndPoint
+       restSubs.xAppRmrEndPoint = restSubscriptionInfo.XAppRmrEndPoint
        restSubs.Meid = restSubscriptionInfo.Meid
        restSubs.InstanceIds = restSubscriptionInfo.InstanceIds
-       restSubs.xAppIdToE2Id = restSubscriptionInfo.xAppIdToE2Id
+       restSubs.xAppIdToE2Id = restSubscriptionInfo.XAppIdToE2Id
        restSubs.SubReqOngoing = restSubscriptionInfo.SubReqOngoing
        restSubs.SubDelReqOngoing = restSubscriptionInfo.SubDelReqOngoing
        restSubs.lastReqMd5sum = restSubscriptionInfo.Md5sum