[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] engine/config uasconfig.cpp,1.7.4.2,1.7.4.3
From:       vijendrakumara () helixcommunity ! org
Date:       2007-12-28 9:30:05
Message-ID: 200712280930.lBS9UFH6026073 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/server/engine/config
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv12256

Modified Files:
      Tag: SERVER_12
	uasconfig.cpp 
Log Message:
Hello,

This CR contains the new diff for PR.

This time I have tested almost all combination of addition, deletion and
modification of old and new UAS.

Synopsis

=========

CR : Fix for PR : 208997: Admin page-> Server Setup->Media Delivery->
‘User Agent String’ Addition and Deletion functionality not working
properly.

Branches: SERVER_12_RN

Suggested Reviewer: Darrick Lew

Description

===========

I debug the code and found that the callback e,g Added Prop, Modified
Prop, DeleteProp are not getting scheduled properly.

Actually we were setting the property watches on all fields.
e.g

<List Name="MatchUserAgents">
        <Var UserAgent_1="MatchUserAgents2"/>
        <Var UserAgent_2="MatchUserAgents3"/>
</List>

For above list we are setting watches for
1.        MatchUserAgent (COMPOSITE)
2.        MatchUserAgent. UserAgent_1 ( Property )
3.        MatchUserAgent. UserAgent_2 ( Property )

Here the problem is if we modify any property inside MatchUserAgent List
then client send a request
1.        to delete the matchuseragent list
2.        to add MatchuserAgent.UserAgent_1 and MatchuserAgent.UserAgent_2
with
updated value.

While deleting matchuseragent list ( inside del() function of servreg.cpp
) we check for propwatch->m_lwatchCount which we are getting as > 0 in
above case. Because of that the second request callback get’s schedule for
modified prop( Actually should gets schedule for AddedProp ).

Actually I look at other code and found that we should not set watches on
composite.
e.g in above case we should set watches only on properties.

1. MatchUserAgent. UserAgent_1 ( Property )
2. MatchUserAgent. UserAgent_2 ( Property )


** Set watches on root node i.e uas.profile and its immediate child nodes.


Fix
============

Remove setWatch and clearWatch call on composite.


Files Affected
==============

Server\engine\config\uasconfig.cpp

Testing Performed

=================

Functional Tests:
-----------------

- Verified by sending request from admin page. It is working fine.

Integration Tests:

n/a

Leak Tests:

n/a

Performance Tests:

n/a

Platforms Tested: win32-i386-vc7

Build verified:
win32-i386-vc7
linux-rhel4-i686
sunos-5.10-sparc-server

QA Hints
========

None

Thanks and Regards
Vijendra


Index: uasconfig.cpp
===================================================================
RCS file: /cvsroot/server/engine/config/uasconfig.cpp,v
retrieving revision 1.7.4.2
retrieving revision 1.7.4.3
diff -u -d -r1.7.4.2 -r1.7.4.3
--- uasconfig.cpp	21 Dec 2007 05:33:55 -0000	1.7.4.2
+++ uasconfig.cpp	28 Dec 2007 09:30:02 -0000	1.7.4.3
@@ -356,7 +356,7 @@
     }
 
 
-	UINT32* pulChildIDs = NULL;
+    UINT32* pulChildIDs = NULL;
     UINT32 ulCount = 0;
     UINT32 i;
 
@@ -394,7 +394,29 @@
 
     if(ulCompositeId)
     {
-        SetWatchOnComposite(ulCompositeId);
+        m_pPropWatch->SetWatchById(ulCompositeId);
+        UINT32* pulChildIDs = NULL;
+        UINT32 ulCount = 0;
+        UINT32 i;
+
+        if(SUCCEEDED(m_pRegistry->GetChildIdListById(ulCompositeId, 
+            pulChildIDs, ulCount)))
+        {
+            for(i = 0; i < ulCount; i++)
+            {
+                HXPropType childType = m_pRegistry->GetTypeById(pulChildIDs[i]);
+                if(childType == PT_COMPOSITE) 
+                {
+                    m_pPropWatch->SetWatchById(pulChildIDs[i]);
+                    SetWatchOnComposite(pulChildIDs[i]);
+                }
+                else
+                {
+                    m_pPropWatch->SetWatchById(pulChildIDs[i]);
+                }
+            }
+            HX_VECTOR_DELETE(pulChildIDs);
+        }
     }
 
     ulCompositeId = m_pRegistry->GetId(QOS_USER_AGENT_PROFILE_ROOT);
@@ -418,7 +440,7 @@
     }
     
 
-	UINT32* pulChildIDs = NULL;
+    UINT32* pulChildIDs = NULL;
     UINT32 ulCount = 0;
     UINT32 i;
 
@@ -453,7 +475,29 @@
 
     if(ulCompositeId)
     {
-        ClearWatchOnComposite(ulCompositeId);
+        m_pPropWatch->ClearWatchById(ulCompositeId);
+        UINT32* pulChildIDs = NULL;
+        UINT32 ulCount = 0;
+        UINT32 i;
+
+        if(SUCCEEDED(m_pRegistry->GetChildIdListById(ulCompositeId, 
+            pulChildIDs, ulCount)))
+        {
+            for(i = 0; i < ulCount; i++)
+            {
+                HXPropType childType = m_pRegistry->GetTypeById(pulChildIDs[i]);
+                if(childType == PT_COMPOSITE) 
+                {
+                    m_pPropWatch->ClearWatchById(pulChildIDs[i]);
+                    ClearWatchOnComposite(pulChildIDs[i]);
+                }
+                else
+                {
+                    m_pPropWatch->ClearWatchById(pulChildIDs[i]);
+                }
+            }
+            HX_VECTOR_DELETE(pulChildIDs);
+        }
     }
 
     ulCompositeId = m_pRegistry->GetId(QOS_USER_AGENT_PROFILE_ROOT);
@@ -635,7 +679,7 @@
     SaveUASPathToRegistry(pszUASName, pszUASFilePath);
 
     HX_RESULT hResult = SaveUASToFile(pszUASName, pszUASFilePath);
-
+    m_pPropWatch->SetWatchById(id);
     return hResult;
 }
 
@@ -688,7 +732,7 @@
     {
         RefreshUASConfigTree();
     }
-	
+    
     return hResult;
 }
 
@@ -794,7 +838,7 @@
         {
             RefreshUASConfigTree();
         }
-		
+        
         return hResult;
     }
 }
@@ -845,7 +889,7 @@
             const HXBOOL    bIsParentNotify,
             IHXBuffer*      pName)
 {
-	HX_RESULT hResult = HXR_OK;
+    HX_RESULT hResult = HXR_OK;
     if(bIsParentNotify)
     {
         if(ExistsInRegistry(ulParentID))
@@ -1013,21 +1057,21 @@
         ERRMSG(m_pMessages, " ");
     }
 
-	switch(pNode->m_type)
-	{
-	    case CfgVar:
+    switch(pNode->m_type)
+    {
+        case CfgVar:
             ERRMSG(m_pMessages, "Var Name=%s, Value=%s", pNode->m_name, pNode->m_value);
-		    break;
+            break;
 
-	    case CfgList:
+        case CfgList:
             ERRMSG(m_pMessages, "List Name=%s", pNode->m_name);
             for(CHXSimpleList::Iterator i = pNode->m_pList->Begin(); 
                 i != pNode->m_pList->End(); 
                 ++i)
             {
                 ERRMSG(m_pMessages, "\n");
-	            PrintUASTree((XMLConfig::XMLConfigListNode*)(*i), lIndent + 4);
+                PrintUASTree((XMLConfig::XMLConfigListNode*)(*i), lIndent + 4);
             }
-		    break;
-	}
+            break;
+    }
 }


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic