Ticket #11922: 0008-NodeManager-Add-missing-notifications-for-node-delet.patch

File 0008-NodeManager-Add-missing-notifications-for-node-delet.patch, 2.7 KB (added by Barrett, 5 years ago)
  • src/servers/media/NodeManager.cpp

    From 1169d03997f36a9531c0efbf6c8cce7aefe367bb Mon Sep 17 00:00:00 2001
    From: Dario Casalinuovo <b.vitruvio@gmail.com>
    Date: Thu, 26 Mar 2015 17:30:43 +0100
    Subject: [PATCH 08/13] NodeManager: Add missing notifications for node
     deletion/flavors status change.
    
    ---
     src/servers/media/NodeManager.cpp | 23 ++++++++++++++++++-----
     1 file changed, 18 insertions(+), 5 deletions(-)
    
    diff --git a/src/servers/media/NodeManager.cpp b/src/servers/media/NodeManager.cpp
    index 69e72c6..f29fe3e 100644
    a b  
    4141
    4242#include <debug.h>
    4343#include <MediaMisc.h>
     44#include <Notifications.h>
    4445
    4546#include "AppManager.h"
    4647#include "DefaultManager.h"
    NodeManager::CleanupDormantFlavorInfos()  
    980981    PRINT(1, "NodeManager::CleanupDormantFlavorInfos\n");
    981982
    982983    BAutolock _(this);
     984
     985    for (DormantFlavorList::iterator iterator = fDormantFlavors.begin();
     986            iterator != fDormantFlavors.end(); iterator++) {
     987        dormant_add_on_flavor_info& info = *iterator;
     988
     989        // Current instance count is zero since the media_addon_server crashed.
     990        BPrivate::media::notifications::FlavorsChanged(info.add_on_id,
     991            0, info.instances_count);
     992    }
     993
    983994    fDormantFlavors.clear();
    984     // TODO: FlavorsChanged() notification
    985995
    986996    PRINT(1, "NodeManager::CleanupDormantFlavorInfos done\n");
    987997}
    NodeManager::CleanupTeam(team_id team)  
    10911101
    10921102    PRINT(1, "NodeManager::CleanupTeam: team %" B_PRId32 "\n", team);
    10931103
    1094     // TODO: send notifications after removing nodes
    1095 
    10961104    // Cleanup node references
    10971105
    10981106    for (NodeMap::iterator iterator = fNodeMap.begin();
    NodeManager::CleanupTeam(team_id team)  
    11131121            PRINT(1, "NodeManager::CleanupTeam: removing node id %" B_PRId32
    11141122                ", team %" B_PRId32 "\n", node.node_id, team);
    11151123            fNodeMap.erase(remove);
     1124            BPrivate::media::notifications::NodesDeleted(&node.node_id, 1);
    11161125            continue;
    11171126        }
    11181127
    NodeManager::CleanupTeam(team_id team)  
    11291138                    B_PRId32 " that has no teams\n", node.node_id);
    11301139
    11311140                fNodeMap.erase(remove);
     1141                BPrivate::media::notifications::NodesDeleted(&node.node_id, 1);
    11321142            } else
    11331143                node.team_ref_count.erase(teamRef);
    11341144        }
    NodeManager::CleanupTeam(team_id team)  
    11471157                instanceCount->second, flavorInfo.add_on_id,
    11481158                flavorInfo.flavor_id);
    11491159
     1160            int32 count = flavorInfo.instances_count;
    11501161            flavorInfo.instances_count -= instanceCount->second;
    1151             if (flavorInfo.instances_count <= 0)
     1162            if (flavorInfo.instances_count <= 0) {
    11521163                fDormantFlavors.erase(fDormantFlavors.begin() + index--);
    1153             else
     1164                BPrivate::media::notifications::FlavorsChanged(
     1165                    flavorInfo.add_on_id, 0, count);
     1166            } else
    11541167                flavorInfo.team_instances_count.erase(team);
    11551168        }
    11561169    }