[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.63,1.64
From:       jzeng () helixcommunity ! org
Date:       2010-04-23 22:55:42
Message-ID: 201004232255.o3NMtbal022534 () mailer ! progressive-comp ! com
[Download RAW message or body]

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

Modified Files:
	server_stats.cpp 
Log Message:
ynopsis
============
Bug 244229:  All clients (existing and new all playing .hpl) disconnect when Max client connection
exceeds
Branches:  head, SERVER_14_0_RN, SERVER_14_1_RN Suggested Reviewer: anyone

Description
=========== 

The reason is that the second player got rejected but remained connected, and when the first player
need to switch and OnURL was called, now we exceeded the max connection and the first player got
rejected too.

This fix is simple: we need to remember that this connection had been counted and no need to check
again.  For this sspl bug it is simple, because we use the same instance of allowance plugin, and a
member variable would solve the problem.  But for smil and playnow3, we would have the same problem
but with different instances of the plugin, and we will need registry(as dauc did) or something else
to store the information.

So I create a new interface IHXExtendedStats and a new class CExtendedStats for this purpose.  This
class can be added to clientstats, sessionstats or clipstats to save and retrieve special
information.  We just need to use #define to specify the entries we want to add.

Currently I only added it to clientstats to fix this bug.  Later on we can add it to sessionStats,
in the case that we only need the communication, not the logging purpose.

Files Affected
==============
server/include/hxprivstats.h,v
server/include/server_piids.h,v
server/engine/context/server_stats.cpp,v
server/engine/context/pub/server_stats.h,v
server-restricted/access/allow/allow.cpp,v
server-restricted/access/allow/allow.h,v

Testing Performed
================= 

Unit Tests: 
None. 

Integration Tests: 
verify the bug is fixed.

Leak Tests: 
None. 

Performance Tests: 
- None 

Platforms Tested: win32-i386-vc7
Build verified: win32-i386-vc7




Index: server_stats.cpp
===================================================================
RCS file: /cvsroot/server/engine/context/server_stats.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- server_stats.cpp	28 Feb 2010 03:41:48 -0000	1.63
+++ server_stats.cpp	23 Apr 2010 22:55:40 -0000	1.64
@@ -2418,9 +2418,12 @@
 , 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();
 }
 
 
@@ -2450,6 +2453,7 @@
         }
     }
 
+    HX_RELEASE(m_pExtendedStats);
 
     HX_DELETE(m_pSessionTable);
     HX_DELETE(m_pTimerList);
@@ -2552,10 +2556,7 @@
         return HXR_OK;
     }
 
-    // No other interfaces are supported
-    *ppInterfaceObj = NULL;
-    return HXR_NOINTERFACE;
-
+    return m_pExtendedStats->QueryInterface(riid, ppInterfaceObj);
 }
 
 STDMETHODIMP_(IHXClientStatsManager*)
@@ -4379,3 +4380,146 @@
     }
     delete this;
 }
+
+//CExtendedStats
+CExtendedStats::CExtendedStats(UINT32 ulStatsTableSize) :
+  m_lRefCount(0)
+, m_pUINT32Table(NULL)
+, m_pBufferTable(NULL)
+, m_ulTableSize(0)
+{
+    if(ulStatsTableSize > 0)
+    {
+        m_ulTableSize =  ulStatsTableSize;
+        m_pUINT32Table = new UINT32*[m_ulTableSize];
+        memset(m_pUINT32Table, NULL, sizeof(UINT32*)*m_ulTableSize);
+
+        m_pBufferTable = new IHXBuffer*[m_ulTableSize];
+        memset(m_pBufferTable, NULL, sizeof(IHXBuffer*)*m_ulTableSize);
+    }
+}
+
+CExtendedStats::~CExtendedStats()
+{
+    for(UINT32 i = 0; i < m_ulTableSize; i++)
+    {
+        HX_DELETE(m_pUINT32Table[i]);
+        HX_RELEASE(m_pBufferTable[i]);
+    }
+    HX_DELETE(m_pBufferTable);
+    HX_DELETE(m_pUINT32Table);
+}
+
+STDMETHODIMP_(UINT32)
+CExtendedStats::AddRef(void)
+{
+    return InterlockedIncrement(&m_lRefCount);
+}
+
+
+STDMETHODIMP_(UINT32)
+CExtendedStats::Release(void)
+{
+    if (InterlockedDecrement(&m_lRefCount) > 0)
+    {
+        return m_lRefCount;
+    }
+
+    delete this;
+    return 0;
+}
+
+STDMETHODIMP
+CExtendedStats::QueryInterface(REFIID riid,
+                             void** ppInterfaceObj)
+{
+    if (IsEqualIID(riid, IID_IHXExtendedStats))
+    {
+        AddRef();
+        *ppInterfaceObj = (IHXExtendedStats*)this;
+        return HXR_OK;
+    }
+    else if (IsEqualIID(riid, IID_IUnknown))
+    {
+        AddRef();
+        *ppInterfaceObj = (IUnknown*)(IHXExtendedStats*)this;
+        return HXR_OK;
+    }
+    
+    // No other interfaces are supported
+    *ppInterfaceObj = NULL;
+    return HXR_NOINTERFACE;
+}
+
+STDMETHODIMP 
+CExtendedStats::GetUINT32(UINT32 ulID, UINT32& ulValue)
+{
+    if(ulID >= m_ulTableSize)
+    {
+        return HXR_UNEXPECTED;
+    }
+
+    if(m_pUINT32Table[ulID])
+    {
+        ulValue = *(m_pUINT32Table[ulID]);
+        return HXR_OK;
+    }
+    else
+    {
+        return HXR_FAIL;
+    }
+}
+
+STDMETHODIMP 
+CExtendedStats::SetUINT32(UINT32 ulID, UINT32 ulValue)
+{
+    if(ulID >= m_ulTableSize)
+    {
+        return HXR_UNEXPECTED;
+    }
+
+    m_pUINT32Table[ulID] = new UINT32;
+    *(m_pUINT32Table[ulID]) = ulValue;
+    return HXR_OK;
+}
+
+STDMETHODIMP 
+CExtendedStats::GetBuffer(UINT32 ulID, IHXBuffer*& pBuffer)
+{
+    if(ulID >= m_ulTableSize)
+    {
+        return HXR_UNEXPECTED;
+    }
+
+    if(m_pBufferTable[ulID])
+    {
+        pBuffer = m_pBufferTable[ulID];
+        pBuffer->AddRef();
+        return HXR_OK;
+    }
+    else
+    {
+        return HXR_FAIL;
+    }
+}
+
+STDMETHODIMP 
+CExtendedStats::SetBuffer(UINT32 ulID, IHXBuffer* pBuffer)
+{
+    if(ulID >= m_ulTableSize || !pBuffer)
+    {
+        return HXR_UNEXPECTED;
+    }
+
+    pBuffer->AddRef();
+    m_pBufferTable[ulID] = pBuffer;
+    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