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

List:       helix-server-cvs
Subject:    [Server-cvs] engine/context server_stats.cpp,1.67,1.67.22.1
From:       mandagod () helixcommunity ! org
Date:       2013-03-29 7:08:29
[Download RAW message or body]

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


Modified Files:
      Tag: SERVER_VHOST_YIJI_2
	server_stats.cpp 
Log Message:
Add access log for Vhost new feature

Index: server_stats.cpp
===================================================================
RCS file: /cvsroot/server/engine/context/server_stats.cpp,v
retrieving revision 1.67
retrieving revision 1.67.22.1
diff -u -d -r1.67 -r1.67.22.1
--- server_stats.cpp	17 Jan 2012 06:08:24 -0000	1.67
+++ server_stats.cpp	29 Mar 2013 07:08:21 -0000	1.67.22.1
@@ -2483,6 +2483,54 @@
 
 
 ///////////////////////////////////////////////////////////////////////////////
+// ClientStats::ClientStats()
+///////////////////////////////////////////////////////////////////////////////
+
+ClientStats::ClientStats(Process* pProc, const char* pVhostAccount)
+: m_pSessionTable(NULL)
+, m_pProc(pProc)
+, m_RefCount(0)
+, m_pStatsMgr(NULL)
+, m_sVhostAccount(pVhostAccount)
+, m_ulID(0)
+, m_lSessionCount(0)
+, m_lSessionIndex(0)
+, m_pIPAddress(NULL)
+, m_pCBID(NULL)
+, m_pGUID(NULL)
+, m_pClientID(NULL)
+, m_pPNAClientID(NULL)
+, m_pCompanyID(NULL)
+, m_pClientChallenge(NULL)
+, m_pLanguage(NULL)
+, m_pPlayerStartTime(NULL)
+, m_pProtocol(NULL)
+, m_pStartTime(NULL)
+, m_pRequestMethod(NULL)
+, m_pUserAgent(NULL)
+, m_pVersion(NULL)
+, m_pLoadTestPassword(NULL)
+, m_pRTSPEvents(NULL)
+, m_pStreamSelectionInfo(NULL)
+, m_ulControlBytesSent(0)
+, m_ulPort(0)
+, m_ulTotalMediaAdaptations(0)
+, m_ulReasonForTermination(0)
+, m_bIsCloaked(FALSE)
+, m_bIsRDT(FALSE)
+, m_bSupportsMaximumASMBandwidth(FALSE)
+, m_bSupportsMulticast(FALSE)
+, m_bIsPrevAuth(FALSE)
+, m_pExtendedStats(NULL)
+{
+    m_pSessionTable = new CHXID(10);
+    m_pTimerList = new HXList();
+    m_pExtendedStats = new CExtendedStats(EXTENDED_CLIENT_STATS_TABLE_SIZE);
+    m_pExtendedStats->AddRef();
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
 // ClientStats::~ClientStats()
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -2595,6 +2643,14 @@
         return HXR_OK;
     }
 
+    // IHXClientStats3 interface is supported
+    else if (IsEqualIID(riid, IID_IHXClientStats3))
+    {
+        AddRef();
+        *ppInterfaceObj = (IHXClientStats3*)this;
+        return HXR_OK;
+    }
+
     // IHXClientStatsTimerControl interface is supported
     else if (IsEqualIID(riid, IID_IHXClientStatsTimerControl))
     {
@@ -2638,6 +2694,18 @@
     return HXR_OK;
 }
 
+
+///////////////////////////////////////////////////////////////////////////////
+// IHXClientStats::GetVhostAccount()
+///////////////////////////////////////////////////////////////////////////////
+
+STDMETHODIMP_(const char*)
+ClientStats::GetVhostAccount()
+{
+    return (const char*)m_sVhostAccount;
+}
+
+
 ///////////////////////////////////////////////////////////////////////////////
 // IHXClientStats::GetID()
 ///////////////////////////////////////////////////////////////////////////////
@@ -3674,6 +3742,14 @@
         return HXR_OK;
     }
 
+    // IHXClientStatsManager2 interface is supported
+    else if (IsEqualIID(riid, IID_IHXClientStatsManager2))
+    {
+        AddRef();
+        *ppInterfaceObj = (IHXClientStatsManager2*)this;
+        return HXR_OK;
+    }
+
     // No other interfaces are supported
     *ppInterfaceObj = NULL;
     return HXR_NOINTERFACE;
@@ -3702,6 +3778,26 @@
     return m_pMgr->RemoveSink(pSink);
 }
 
+///////////////////////////////////////////////////////////////////////////////
+// IHXClientStatsManagerPerProcessWrapper::RegisterVhostSink()
+///////////////////////////////////////////////////////////////////////////////
+
+STDMETHODIMP
+ClientStatsManagerPerProcessWrapper::RegisterVhostSink(IHXClientStatsSink* pSink, \
const char* pVhostAccount) +{
+    return m_pMgr->RegisterVhostSink(pSink, m_pProc, pVhostAccount);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// IHXClientStatsManagerPerProcessWrapper::RemoveSink()
+///////////////////////////////////////////////////////////////////////////////
+
+STDMETHODIMP
+ClientStatsManagerPerProcessWrapper::RemoveVhostSink(IHXClientStatsSink* pSink, \
const char* pVhostAccount)  +{
+    return m_pMgr->RemoveVhostSink(pSink, pVhostAccount);
+}
 
 ///////////////////////////////////////////////////////////////////////////////
 // IHXClientStatsManagerPerProcessWrapper::AddClient()
@@ -3786,6 +3882,7 @@
 : m_pClientList(NULL)
 , m_pClientTable(NULL)
 , m_pSinkList(NULL)
+, m_pVhostSinkMap(NULL)
 , m_RefCount(0)
 , m_ulCurrentId(0)
 , m_bUseRegistryForStats(FALSE)
@@ -3794,6 +3891,7 @@
     m_pClientList = new HXList();
     m_pClientTable = new CHXID(MAX_CLIENT_STATS_ID);
     m_pSinkList = new HXList();
+    m_pVhostSinkMap = new Dict();
 
     m_pMutex = HXMutexCreate();
     HXMutexInit(m_pMutex);
@@ -3834,6 +3932,24 @@
     HX_DELETE(m_pSinkList);
     HX_DELETE(m_pClientTable);
 
+    if (m_pVhostSinkMap)
+    {
+        SinkListElem* pTemp = NULL;
+        
+        for (Dict_iterator di(m_pVhostSinkMap); (*di) != 0; ++di)
+        {
+            pTemp = (SinkListElem*)((Dict_entry*)*di)->obj;
+            if (pTemp)
+            {
+                HX_RELEASE(pTemp->m_pSink);
+                HX_DELETE(pTemp);
+            }
+        }
+    }
+
+    m_pVhostSinkMap->empty();
+    HX_DELETE(m_pVhostSinkMap);
+
     HXMutexDestroy(m_pMutex);
 }
 
@@ -3899,6 +4015,65 @@
 
 
 ///////////////////////////////////////////////////////////////////////////////
+// IHXClientStatsManager2::RegisterVhostSink()
+///////////////////////////////////////////////////////////////////////////////
+
+HX_RESULT
+ClientStatsManager::RegisterVhostSink(IHXClientStatsSink* pSink, Process* pProc, \
const char* pVhostAccount) +{
+    HXMutexLock(m_pMutex, TRUE);
+    
+    SinkListElem* pElem = new SinkListElem;
+
+    pElem->m_pSink = pSink;
+    pSink->AddRef();
+    pElem->m_pProc = pProc;
+
+    if (NULL != pVhostAccount)
+    {
+        m_pVhostSinkMap->enter(pVhostAccount, (void *)pElem);
+
+        HXMutexUnlock(m_pMutex);
+
+        return HXR_OK;
+    }
+
+    HXMutexUnlock(m_pMutex);
+
+    return HXR_FAIL;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// IHXClientStatsManager2::RemoveVhostSink()
+///////////////////////////////////////////////////////////////////////////////
+
+HX_RESULT
+ClientStatsManager::RemoveVhostSink(IHXClientStatsSink* pSink, const char* \
pVhostAccount) +{
+    SinkListElem* pElem = NULL;
+
+    if (NULL != pVhostAccount)
+    {
+        HXMutexLock(m_pMutex, TRUE);
+
+        pElem = (SinkListElem *)m_pVhostSinkMap->remove(pVhostAccount);
+
+        if (pElem)
+        {
+            HX_RELEASE(pElem->m_pSink);
+            HX_DELETE(pElem);
+        }
+    
+        HXMutexUnlock(m_pMutex);
+
+        return HXR_OK;
+    }
+
+    return HXR_FAIL;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
 // IHXClientStatsManager::AddClient()
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -3960,6 +4135,55 @@
         }
     }
 
+    IHXClientStats3* pClient3 = NULL;
+    if (HXR_OK != pClient->QueryInterface(IID_IHXClientStats3, (void**)&pClient3) 
+                                                   || (!pClient3))
+    {
+        return HXR_FAIL;
+    }
+    
+    const char* pVhostAccount = pClient3->GetVhostAccount();
+    HX_RELEASE(pClient3);
+
+    if (!pVhostAccount)
+    {
+        // Virtual hosting is disable
+        return HXR_OK;
+    }
+
+    Dict_entry* di = m_pVhostSinkMap->find(pVhostAccount);
+    if (di)
+    {
+        SinkListElem* pSinkInfo = (SinkListElem*)di->obj;
+
+        if (!pSinkInfo)
+        {
+            return HXR_FAIL;
+        }        
+
+        if (pSinkInfo->m_pSink->GetStatsTimerInterval() > 0)
+        {
+            ClientStatsTimer* pTimer             = new ClientStatsTimer;
+            IHXClientStatsTimerControl* pControl = NULL;
+
+            pTimer->Init(pClient,
+                         pSinkInfo->m_pSink,
+                         pProc,
+                         pSinkInfo->m_pProc);
+
+            if (FAILED(pClient->QueryInterface(IID_IHXClientStatsTimerControl,
+                                               (void**)&pControl)))
+            {
+                HX_ASSERT(!"Unable to QI for stats timer control from client stats \
obj!"); +                HX_DELETE(pTimer);
+                return HXR_FAIL;
+            }
+
+            pControl->SetTimer(pTimer);
+            HX_RELEASE(pControl);            
+        }
+    }
+
     return HXR_OK;
 }
 
@@ -4139,15 +4363,46 @@
                   nEvent);
         pProc->pc->dispatchq->send(pProc, pCB, pSinkInfo->m_pProc->procnum());
     }
+    
+    IHXClientStats3* pClient3 = NULL;
+    pClient->QueryInterface(IID_IHXClientStats3, (void**)&pClient3);
+    if (HXR_OK != pClient->QueryInterface(IID_IHXClientStats3, (void**)&pClient3) 
+                                                   || (!pClient3))
+    {
+        return HXR_FAIL;
+    }
+    
+    const char* pVhostAccount = pClient3->GetVhostAccount();
+    HX_RELEASE(pClient3);
 
-    return HXR_OK;
-}
-
-
-
-
+    if (!pVhostAccount)
+    {
+        // Virtual hosting is disable
+        return HXR_OK;
+    }
 
+    Dict_entry* di = m_pVhostSinkMap->find(pVhostAccount);
+    if (di)
+    {
+        SinkListElem* pSinkInfo = (SinkListElem*)di->obj;
 
+        if (!pSinkInfo)
+        {
+            return HXR_FAIL;
+        }
+        
+        ClientStatsSinkNotifyCallback* pCB = new ClientStatsSinkNotifyCallback();
+        pCB->Init(pClient,
+                pSession,
+                pClip,
+                pSinkInfo->m_pSink,
+                pSinkInfo->m_pProc,
+                nEvent);
+        pProc->pc->dispatchq->send(pProc, pCB, pSinkInfo->m_pProc->procnum());
+    }
+    
+    return HXR_OK;
+}
 
 
 ///////////////////////////////////////////////////////////////////////////////


_______________________________________________
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