Loading go-apps/meep-loc-serv/server/loc-serv.go +14 −18 Original line number Diff line number Diff line Loading @@ -206,8 +206,8 @@ func createClient(notifyPath string) (*clientNotifOMA.APIClient, error) { func deregisterZoneStatus(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() zoneStatusSubscriptionMap[subsId] = nil mutex.Unlock() } func registerZoneStatus(zoneId string, nbOfUsersZoneThreshold int32, nbOfUsersAPThreshold int32, opStatus []OperationStatus, subsIdStr string) { Loading @@ -232,18 +232,18 @@ func registerZoneStatus(zoneId string, nbOfUsersZoneThreshold int32, nbOfUsersAP zoneStatus.NbUsersInAPThreshold = (int)(nbOfUsersAPThreshold) zoneStatus.ZoneId = zoneId mutex.Lock() defer mutex.Unlock() zoneStatusSubscriptionMap[subsId] = &zoneStatus mutex.Unlock() } func deregisterZonal(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() zonalSubscriptionMap[subsId] = "" zonalSubscriptionEnteringMap[subsId] = "" zonalSubscriptionLeavingMap[subsId] = "" zonalSubscriptionTransferringMap[subsId] = "" mutex.Unlock() } func registerZonal(zoneId string, event []UserEventType, subsIdStr string) { Loading @@ -251,6 +251,7 @@ func registerZonal(zoneId string, event []UserEventType, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() if event != nil { for i := 0; i < len(event); i++ { switch event[i] { Loading @@ -269,23 +270,23 @@ func registerZonal(zoneId string, event []UserEventType, subsIdStr string) { zonalSubscriptionTransferringMap[subsId] = zoneId } zonalSubscriptionMap[subsId] = zoneId mutex.Unlock() } func deregisterUser(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() userSubscriptionMap[subsId] = "" userSubscriptionEnteringMap[subsId] = "" userSubscriptionLeavingMap[subsId] = "" userSubscriptionTransferringMap[subsId] = "" mutex.Unlock() } func registerUser(userAddress string, event []UserEventType, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() if event != nil { for i := 0; i < len(event); i++ { switch event[i] { Loading @@ -304,7 +305,6 @@ func registerUser(userAddress string, event []UserEventType, subsIdStr string) { userSubscriptionTransferringMap[subsId] = userAddress } userSubscriptionMap[subsId] = userAddress mutex.Unlock() } func checkNotificationRegistrations(checkType int, param1 string, param2 string, param3 string, param4 string, param5 string) { Loading @@ -324,6 +324,7 @@ func checkNotificationRegistrations(checkType int, param1 string, param2 string, func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersInAPStr string, nbUsersInZoneStr string) { mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, zoneStatus := range zoneStatusSubscriptionMap { Loading Loading @@ -352,7 +353,6 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+typeZoneStatusSubscription+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading @@ -378,13 +378,12 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn } } } mutex.Unlock() } func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApId string, newApId string, userId string) { mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, value := range userSubscriptionMap { if value == userId { Loading @@ -392,7 +391,6 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+typeUserSubscription+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -441,7 +439,6 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI } } } mutex.Unlock() } func sendNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotifOMA.TrackingNotification) { Loading Loading @@ -493,6 +490,7 @@ func sendStatusNotification(notifyUrl string, ctx context.Context, subscriptionI func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApId string, newApId string, userId string) { mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, value := range zonalSubscriptionMap { Loading Loading @@ -572,7 +570,6 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI } } } mutex.Unlock() } func usersGet(w http.ResponseWriter, r *http.Request) { Loading Loading @@ -1328,7 +1325,7 @@ func cleanUp() { nextZoneStatusSubscriptionIdAvailable = 1 mutex.Lock() defer mutex.Unlock() zonalSubscriptionEnteringMap = map[int]string{} zonalSubscriptionLeavingMap = map[int]string{} zonalSubscriptionTransferringMap = map[int]string{} Loading @@ -1341,8 +1338,6 @@ func cleanUp() { zoneStatusSubscriptionMap = map[int]*ZoneStatusCheck{} mutex.Unlock() updateStoreName("") } Loading Loading @@ -1468,6 +1463,7 @@ func zoneStatusReInit() { maxZoneStatusSubscriptionId := 0 mutex.Lock() defer mutex.Unlock() for _, zone := range zoneList.ZoneStatusSubscription { resourceUrl := strings.Split(zone.ResourceURL, "/") subscriptionId, err := strconv.Atoi(resourceUrl[len(resourceUrl)-1]) Loading Loading @@ -1499,7 +1495,6 @@ func zoneStatusReInit() { zoneStatusSubscriptionMap[subscriptionId] = &zoneStatus } } mutex.Unlock() nextZoneStatusSubscriptionIdAvailable = maxZoneStatusSubscriptionId + 1 } Loading @@ -1512,6 +1507,7 @@ func zonalTrafficReInit() { maxZonalSubscriptionId := 0 mutex.Lock() defer mutex.Unlock() for _, zone := range zoneList.ZonalTrafficSubscription { resourceUrl := strings.Split(zone.ResourceURL, "/") subscriptionId, err := strconv.Atoi(resourceUrl[len(resourceUrl)-1]) Loading @@ -1536,7 +1532,6 @@ func zonalTrafficReInit() { zonalSubscriptionMap[subscriptionId] = zone.ZoneId } } mutex.Unlock() nextZonalSubscriptionIdAvailable = maxZonalSubscriptionId + 1 } Loading @@ -1549,6 +1544,8 @@ func userTrackingReInit() { maxUserSubscriptionId := 0 mutex.Lock() defer mutex.Unlock() for _, user := range userList.UserTrackingSubscription { resourceUrl := strings.Split(user.ResourceURL, "/") subscriptionId, err := strconv.Atoi(resourceUrl[len(resourceUrl)-1]) Loading @@ -1573,6 +1570,5 @@ func userTrackingReInit() { userSubscriptionMap[subscriptionId] = user.Address } } mutex.Unlock() nextUserSubscriptionIdAvailable = maxUserSubscriptionId + 1 } go-apps/meep-rnis/server/rnis.go +34 −30 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ func checkForExpiredSubscriptions() { nowTime := int(time.Now().Unix()) mutex.Lock() defer mutex.Unlock() for expiryTime, subsIndexList := range subscriptionExpiryMap { if expiryTime <= nowTime { subscriptionExpiryMap[expiryTime] = nil Loading Loading @@ -340,7 +341,6 @@ func checkForExpiredSubscriptions() { } } } mutex.Unlock() } func repopulateCcSubscriptionMap(key string, jsonInfo string, userData interface{}) error { Loading @@ -358,13 +358,14 @@ func repopulateCcSubscriptionMap(key string, jsonInfo string, userData interface subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() ccSubscriptionMap[subsId] = &subscription if subscription.ExpiryDeadline != nil { intList := subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] intList = append(intList, subsId) subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() //reinitialisation of next available Id for future subscription request if subsId >= nextSubscriptionIdAvailable { Loading @@ -389,13 +390,14 @@ func repopulateReSubscriptionMap(key string, jsonInfo string, userData interface subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() reSubscriptionMap[subsId] = &subscription if subscription.ExpiryDeadline != nil { intList := subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] intList = append(intList, subsId) subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() //reinitialisation of next available Id for future subscription request if subsId >= nextSubscriptionIdAvailable { Loading @@ -420,13 +422,14 @@ func repopulateRrSubscriptionMap(key string, jsonInfo string, userData interface subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() rrSubscriptionMap[subsId] = &subscription if subscription.ExpiryDeadline != nil { intList := subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] intList = append(intList, subsId) subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() //reinitialisation of next available Id for future subscription request if subsId >= nextSubscriptionIdAvailable { Loading @@ -444,7 +447,7 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate } mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, sub := range ccSubscriptionMap { Loading Loading @@ -501,7 +504,6 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+cellChangeSubscriptionType+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -553,7 +555,6 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate } } } mutex.Unlock() } func checkReNotificationRegisteredSubscriptions(appId string, assocId *AssociateId, newPlmn *Plmn, oldPlmn *Plmn, qci int32, newCellId string, oldCellId string, erabId int32) { Loading @@ -564,7 +565,7 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate } mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, sub := range reSubscriptionMap { Loading Loading @@ -615,7 +616,6 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+rabEstSubscriptionType+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -654,7 +654,6 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate } } } mutex.Unlock() } func checkRrNotificationRegisteredSubscriptions(appId string, assocId *AssociateId, newPlmn *Plmn, oldPlmn *Plmn, qci int32, newCellId string, oldCellId string, erabId int32) { Loading @@ -665,7 +664,7 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate } mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, sub := range rrSubscriptionMap { Loading Loading @@ -716,7 +715,6 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+rabRelSubscriptionType+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -753,7 +751,6 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate } } } mutex.Unlock() } func sendCcNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotif.CellChangeNotification) { Loading Loading @@ -890,12 +887,13 @@ func isSubscriptionIdRegisteredCc(subsIdStr string) bool { var returnVal bool subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() if ccSubscriptionMap[subsId] != nil { returnVal = true } else { returnVal = false } mutex.Unlock() return returnVal } Loading @@ -903,12 +901,13 @@ func isSubscriptionIdRegisteredRe(subsIdStr string) bool { subsId, _ := strconv.Atoi(subsIdStr) var returnVal bool mutex.Lock() defer mutex.Unlock() if reSubscriptionMap[subsId] != nil { returnVal = true } else { returnVal = false } mutex.Unlock() return returnVal } Loading @@ -916,18 +915,21 @@ func isSubscriptionIdRegisteredRr(subsIdStr string) bool { subsId, _ := strconv.Atoi(subsIdStr) var returnVal bool mutex.Lock() defer mutex.Unlock() if rrSubscriptionMap[subsId] != nil { returnVal = true } else { returnVal = false } mutex.Unlock() return returnVal } func registerCc(cellChangeSubscription *CellChangeSubscription, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() ccSubscriptionMap[subsId] = cellChangeSubscription if cellChangeSubscription.ExpiryDeadline != nil { //get current list of subscription meant to expire at this time Loading @@ -935,13 +937,14 @@ func registerCc(cellChangeSubscription *CellChangeSubscription, subsIdStr string intList = append(intList, subsId) subscriptionExpiryMap[int(cellChangeSubscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() log.Info("New registration: ", subsId, " type: ", cellChangeSubscriptionType) } func registerRe(rabEstSubscription *RabEstSubscription, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() reSubscriptionMap[subsId] = rabEstSubscription if rabEstSubscription.ExpiryDeadline != nil { //get current list of subscription meant to expire at this time Loading @@ -949,13 +952,14 @@ func registerRe(rabEstSubscription *RabEstSubscription, subsIdStr string) { intList = append(intList, subsId) subscriptionExpiryMap[int(rabEstSubscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() log.Info("New registration: ", subsId, " type: ", rabEstSubscriptionType) } func registerRr(rabRelSubscription *RabRelSubscription, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() rrSubscriptionMap[subsId] = rabRelSubscription if rabRelSubscription.ExpiryDeadline != nil { //get current list of subscription meant to expire at this time Loading @@ -963,31 +967,33 @@ func registerRr(rabRelSubscription *RabRelSubscription, subsIdStr string) { intList = append(intList, subsId) subscriptionExpiryMap[int(rabRelSubscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() log.Info("New registration: ", subsId, " type: ", rabRelSubscriptionType) } func deregisterCc(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() ccSubscriptionMap[subsId] = nil mutex.Unlock() log.Info("Deregistration: ", subsId, " type: ", cellChangeSubscriptionType) } func deregisterRe(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() reSubscriptionMap[subsId] = nil mutex.Unlock() log.Info("Deregistration: ", subsId, " type: ", rabEstSubscriptionType) } func deregisterRr(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() rrSubscriptionMap[subsId] = nil mutex.Unlock() log.Info("Deregistration: ", subsId, " type: ", rabRelSubscriptionType) } Loading Loading @@ -1616,9 +1622,11 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { //loop through all different types of subscription mutex.Lock() defer mutex.Unlock() if subType == "" || subType == cellChangeSubscriptionType { //loop through cell_change map mutex.Lock() for _, ccSubscription := range ccSubscriptionMap { if ccSubscription != nil { var subscription Subscription Loading @@ -1628,11 +1636,9 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { subscriptionLinkList.Subscription = append(subscriptionLinkList.Subscription, subscription) } } mutex.Unlock() } if subType == "" || subType == rabEstSubscriptionType { //loop through cell_change map mutex.Lock() for _, reSubscription := range reSubscriptionMap { if reSubscription != nil { var subscription Subscription Loading @@ -1642,11 +1648,9 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { subscriptionLinkList.Subscription = append(subscriptionLinkList.Subscription, subscription) } } mutex.Unlock() } if subType == "" || subType == rabRelSubscriptionType { //loop through cell_change map mutex.Lock() for _, rrSubscription := range rrSubscriptionMap { if rrSubscription != nil { var subscription Subscription Loading @@ -1656,7 +1660,6 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { subscriptionLinkList.Subscription = append(subscriptionLinkList.Subscription, subscription) } } mutex.Unlock() } //no other maps to go through Loading Loading @@ -1747,12 +1750,13 @@ func cleanUp() { nextAvailableErabId = 1 mutex.Lock() defer mutex.Unlock() ccSubscriptionMap = map[int]*CellChangeSubscription{} reSubscriptionMap = map[int]*RabEstSubscription{} rrSubscriptionMap = map[int]*RabRelSubscription{} mutex.Unlock() subscriptionExpiryMap = map[int][]int{} updateStoreName("") } Loading Loading
go-apps/meep-loc-serv/server/loc-serv.go +14 −18 Original line number Diff line number Diff line Loading @@ -206,8 +206,8 @@ func createClient(notifyPath string) (*clientNotifOMA.APIClient, error) { func deregisterZoneStatus(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() zoneStatusSubscriptionMap[subsId] = nil mutex.Unlock() } func registerZoneStatus(zoneId string, nbOfUsersZoneThreshold int32, nbOfUsersAPThreshold int32, opStatus []OperationStatus, subsIdStr string) { Loading @@ -232,18 +232,18 @@ func registerZoneStatus(zoneId string, nbOfUsersZoneThreshold int32, nbOfUsersAP zoneStatus.NbUsersInAPThreshold = (int)(nbOfUsersAPThreshold) zoneStatus.ZoneId = zoneId mutex.Lock() defer mutex.Unlock() zoneStatusSubscriptionMap[subsId] = &zoneStatus mutex.Unlock() } func deregisterZonal(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() zonalSubscriptionMap[subsId] = "" zonalSubscriptionEnteringMap[subsId] = "" zonalSubscriptionLeavingMap[subsId] = "" zonalSubscriptionTransferringMap[subsId] = "" mutex.Unlock() } func registerZonal(zoneId string, event []UserEventType, subsIdStr string) { Loading @@ -251,6 +251,7 @@ func registerZonal(zoneId string, event []UserEventType, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() if event != nil { for i := 0; i < len(event); i++ { switch event[i] { Loading @@ -269,23 +270,23 @@ func registerZonal(zoneId string, event []UserEventType, subsIdStr string) { zonalSubscriptionTransferringMap[subsId] = zoneId } zonalSubscriptionMap[subsId] = zoneId mutex.Unlock() } func deregisterUser(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() userSubscriptionMap[subsId] = "" userSubscriptionEnteringMap[subsId] = "" userSubscriptionLeavingMap[subsId] = "" userSubscriptionTransferringMap[subsId] = "" mutex.Unlock() } func registerUser(userAddress string, event []UserEventType, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() if event != nil { for i := 0; i < len(event); i++ { switch event[i] { Loading @@ -304,7 +305,6 @@ func registerUser(userAddress string, event []UserEventType, subsIdStr string) { userSubscriptionTransferringMap[subsId] = userAddress } userSubscriptionMap[subsId] = userAddress mutex.Unlock() } func checkNotificationRegistrations(checkType int, param1 string, param2 string, param3 string, param4 string, param5 string) { Loading @@ -324,6 +324,7 @@ func checkNotificationRegistrations(checkType int, param1 string, param2 string, func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersInAPStr string, nbUsersInZoneStr string) { mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, zoneStatus := range zoneStatusSubscriptionMap { Loading Loading @@ -352,7 +353,6 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+typeZoneStatusSubscription+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading @@ -378,13 +378,12 @@ func checkNotificationRegisteredZoneStatus(zoneId string, apId string, nbUsersIn } } } mutex.Unlock() } func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApId string, newApId string, userId string) { mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, value := range userSubscriptionMap { if value == userId { Loading @@ -392,7 +391,6 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+typeUserSubscription+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -441,7 +439,6 @@ func checkNotificationRegisteredUsers(oldZoneId string, newZoneId string, oldApI } } } mutex.Unlock() } func sendNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotifOMA.TrackingNotification) { Loading Loading @@ -493,6 +490,7 @@ func sendStatusNotification(notifyUrl string, ctx context.Context, subscriptionI func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApId string, newApId string, userId string) { mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, value := range zonalSubscriptionMap { Loading Loading @@ -572,7 +570,6 @@ func checkNotificationRegisteredZones(oldZoneId string, newZoneId string, oldApI } } } mutex.Unlock() } func usersGet(w http.ResponseWriter, r *http.Request) { Loading Loading @@ -1328,7 +1325,7 @@ func cleanUp() { nextZoneStatusSubscriptionIdAvailable = 1 mutex.Lock() defer mutex.Unlock() zonalSubscriptionEnteringMap = map[int]string{} zonalSubscriptionLeavingMap = map[int]string{} zonalSubscriptionTransferringMap = map[int]string{} Loading @@ -1341,8 +1338,6 @@ func cleanUp() { zoneStatusSubscriptionMap = map[int]*ZoneStatusCheck{} mutex.Unlock() updateStoreName("") } Loading Loading @@ -1468,6 +1463,7 @@ func zoneStatusReInit() { maxZoneStatusSubscriptionId := 0 mutex.Lock() defer mutex.Unlock() for _, zone := range zoneList.ZoneStatusSubscription { resourceUrl := strings.Split(zone.ResourceURL, "/") subscriptionId, err := strconv.Atoi(resourceUrl[len(resourceUrl)-1]) Loading Loading @@ -1499,7 +1495,6 @@ func zoneStatusReInit() { zoneStatusSubscriptionMap[subscriptionId] = &zoneStatus } } mutex.Unlock() nextZoneStatusSubscriptionIdAvailable = maxZoneStatusSubscriptionId + 1 } Loading @@ -1512,6 +1507,7 @@ func zonalTrafficReInit() { maxZonalSubscriptionId := 0 mutex.Lock() defer mutex.Unlock() for _, zone := range zoneList.ZonalTrafficSubscription { resourceUrl := strings.Split(zone.ResourceURL, "/") subscriptionId, err := strconv.Atoi(resourceUrl[len(resourceUrl)-1]) Loading @@ -1536,7 +1532,6 @@ func zonalTrafficReInit() { zonalSubscriptionMap[subscriptionId] = zone.ZoneId } } mutex.Unlock() nextZonalSubscriptionIdAvailable = maxZonalSubscriptionId + 1 } Loading @@ -1549,6 +1544,8 @@ func userTrackingReInit() { maxUserSubscriptionId := 0 mutex.Lock() defer mutex.Unlock() for _, user := range userList.UserTrackingSubscription { resourceUrl := strings.Split(user.ResourceURL, "/") subscriptionId, err := strconv.Atoi(resourceUrl[len(resourceUrl)-1]) Loading @@ -1573,6 +1570,5 @@ func userTrackingReInit() { userSubscriptionMap[subscriptionId] = user.Address } } mutex.Unlock() nextUserSubscriptionIdAvailable = maxUserSubscriptionId + 1 }
go-apps/meep-rnis/server/rnis.go +34 −30 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ func checkForExpiredSubscriptions() { nowTime := int(time.Now().Unix()) mutex.Lock() defer mutex.Unlock() for expiryTime, subsIndexList := range subscriptionExpiryMap { if expiryTime <= nowTime { subscriptionExpiryMap[expiryTime] = nil Loading Loading @@ -340,7 +341,6 @@ func checkForExpiredSubscriptions() { } } } mutex.Unlock() } func repopulateCcSubscriptionMap(key string, jsonInfo string, userData interface{}) error { Loading @@ -358,13 +358,14 @@ func repopulateCcSubscriptionMap(key string, jsonInfo string, userData interface subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() ccSubscriptionMap[subsId] = &subscription if subscription.ExpiryDeadline != nil { intList := subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] intList = append(intList, subsId) subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() //reinitialisation of next available Id for future subscription request if subsId >= nextSubscriptionIdAvailable { Loading @@ -389,13 +390,14 @@ func repopulateReSubscriptionMap(key string, jsonInfo string, userData interface subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() reSubscriptionMap[subsId] = &subscription if subscription.ExpiryDeadline != nil { intList := subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] intList = append(intList, subsId) subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() //reinitialisation of next available Id for future subscription request if subsId >= nextSubscriptionIdAvailable { Loading @@ -420,13 +422,14 @@ func repopulateRrSubscriptionMap(key string, jsonInfo string, userData interface subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() rrSubscriptionMap[subsId] = &subscription if subscription.ExpiryDeadline != nil { intList := subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] intList = append(intList, subsId) subscriptionExpiryMap[int(subscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() //reinitialisation of next available Id for future subscription request if subsId >= nextSubscriptionIdAvailable { Loading @@ -444,7 +447,7 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate } mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, sub := range ccSubscriptionMap { Loading Loading @@ -501,7 +504,6 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+cellChangeSubscriptionType+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -553,7 +555,6 @@ func checkCcNotificationRegisteredSubscriptions(appId string, assocId *Associate } } } mutex.Unlock() } func checkReNotificationRegisteredSubscriptions(appId string, assocId *AssociateId, newPlmn *Plmn, oldPlmn *Plmn, qci int32, newCellId string, oldCellId string, erabId int32) { Loading @@ -564,7 +565,7 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate } mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, sub := range reSubscriptionMap { Loading Loading @@ -615,7 +616,6 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+rabEstSubscriptionType+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -654,7 +654,6 @@ func checkReNotificationRegisteredSubscriptions(appId string, assocId *Associate } } } mutex.Unlock() } func checkRrNotificationRegisteredSubscriptions(appId string, assocId *AssociateId, newPlmn *Plmn, oldPlmn *Plmn, qci int32, newCellId string, oldCellId string, erabId int32) { Loading @@ -665,7 +664,7 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate } mutex.Lock() defer mutex.Unlock() //check all that applies for subsId, sub := range rrSubscriptionMap { Loading Loading @@ -716,7 +715,6 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate subsIdStr := strconv.Itoa(subsId) jsonInfo, _ := rc.JSONGetEntry(baseKey+rabRelSubscriptionType+":"+subsIdStr, ".") if jsonInfo == "" { mutex.Unlock() return } Loading Loading @@ -753,7 +751,6 @@ func checkRrNotificationRegisteredSubscriptions(appId string, assocId *Associate } } } mutex.Unlock() } func sendCcNotification(notifyUrl string, ctx context.Context, subscriptionId string, notification clientNotif.CellChangeNotification) { Loading Loading @@ -890,12 +887,13 @@ func isSubscriptionIdRegisteredCc(subsIdStr string) bool { var returnVal bool subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() if ccSubscriptionMap[subsId] != nil { returnVal = true } else { returnVal = false } mutex.Unlock() return returnVal } Loading @@ -903,12 +901,13 @@ func isSubscriptionIdRegisteredRe(subsIdStr string) bool { subsId, _ := strconv.Atoi(subsIdStr) var returnVal bool mutex.Lock() defer mutex.Unlock() if reSubscriptionMap[subsId] != nil { returnVal = true } else { returnVal = false } mutex.Unlock() return returnVal } Loading @@ -916,18 +915,21 @@ func isSubscriptionIdRegisteredRr(subsIdStr string) bool { subsId, _ := strconv.Atoi(subsIdStr) var returnVal bool mutex.Lock() defer mutex.Unlock() if rrSubscriptionMap[subsId] != nil { returnVal = true } else { returnVal = false } mutex.Unlock() return returnVal } func registerCc(cellChangeSubscription *CellChangeSubscription, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() ccSubscriptionMap[subsId] = cellChangeSubscription if cellChangeSubscription.ExpiryDeadline != nil { //get current list of subscription meant to expire at this time Loading @@ -935,13 +937,14 @@ func registerCc(cellChangeSubscription *CellChangeSubscription, subsIdStr string intList = append(intList, subsId) subscriptionExpiryMap[int(cellChangeSubscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() log.Info("New registration: ", subsId, " type: ", cellChangeSubscriptionType) } func registerRe(rabEstSubscription *RabEstSubscription, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() reSubscriptionMap[subsId] = rabEstSubscription if rabEstSubscription.ExpiryDeadline != nil { //get current list of subscription meant to expire at this time Loading @@ -949,13 +952,14 @@ func registerRe(rabEstSubscription *RabEstSubscription, subsIdStr string) { intList = append(intList, subsId) subscriptionExpiryMap[int(rabEstSubscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() log.Info("New registration: ", subsId, " type: ", rabEstSubscriptionType) } func registerRr(rabRelSubscription *RabRelSubscription, subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() rrSubscriptionMap[subsId] = rabRelSubscription if rabRelSubscription.ExpiryDeadline != nil { //get current list of subscription meant to expire at this time Loading @@ -963,31 +967,33 @@ func registerRr(rabRelSubscription *RabRelSubscription, subsIdStr string) { intList = append(intList, subsId) subscriptionExpiryMap[int(rabRelSubscription.ExpiryDeadline.Seconds)] = intList } mutex.Unlock() log.Info("New registration: ", subsId, " type: ", rabRelSubscriptionType) } func deregisterCc(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() ccSubscriptionMap[subsId] = nil mutex.Unlock() log.Info("Deregistration: ", subsId, " type: ", cellChangeSubscriptionType) } func deregisterRe(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() reSubscriptionMap[subsId] = nil mutex.Unlock() log.Info("Deregistration: ", subsId, " type: ", rabEstSubscriptionType) } func deregisterRr(subsIdStr string) { subsId, _ := strconv.Atoi(subsIdStr) mutex.Lock() defer mutex.Unlock() rrSubscriptionMap[subsId] = nil mutex.Unlock() log.Info("Deregistration: ", subsId, " type: ", rabRelSubscriptionType) } Loading Loading @@ -1616,9 +1622,11 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { //loop through all different types of subscription mutex.Lock() defer mutex.Unlock() if subType == "" || subType == cellChangeSubscriptionType { //loop through cell_change map mutex.Lock() for _, ccSubscription := range ccSubscriptionMap { if ccSubscription != nil { var subscription Subscription Loading @@ -1628,11 +1636,9 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { subscriptionLinkList.Subscription = append(subscriptionLinkList.Subscription, subscription) } } mutex.Unlock() } if subType == "" || subType == rabEstSubscriptionType { //loop through cell_change map mutex.Lock() for _, reSubscription := range reSubscriptionMap { if reSubscription != nil { var subscription Subscription Loading @@ -1642,11 +1648,9 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { subscriptionLinkList.Subscription = append(subscriptionLinkList.Subscription, subscription) } } mutex.Unlock() } if subType == "" || subType == rabRelSubscriptionType { //loop through cell_change map mutex.Lock() for _, rrSubscription := range rrSubscriptionMap { if rrSubscription != nil { var subscription Subscription Loading @@ -1656,7 +1660,6 @@ func createSubscriptionLinkList(subType string) *SubscriptionLinkList { subscriptionLinkList.Subscription = append(subscriptionLinkList.Subscription, subscription) } } mutex.Unlock() } //no other maps to go through Loading Loading @@ -1747,12 +1750,13 @@ func cleanUp() { nextAvailableErabId = 1 mutex.Lock() defer mutex.Unlock() ccSubscriptionMap = map[int]*CellChangeSubscription{} reSubscriptionMap = map[int]*RabEstSubscription{} rrSubscriptionMap = map[int]*RabRelSubscription{} mutex.Unlock() subscriptionExpiryMap = map[int][]int{} updateStoreName("") } Loading