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

List:       helix-protocol-cvs
Subject:    [Protocol-cvs] transport/rdt rdttran.cpp,1.7,1.8
From:       acolwell () helixcommunity ! org
Date:       2004-12-16 19:10:07
[Download RAW message or body]

Update of /cvsroot/protocol/transport/rdt
In directory cvs-new:/tmp/cvs-serv867/rdt

Modified Files:
	rdttran.cpp 
Log Message:
- Removed duplicate ABD code in RDT transports and moved it into the base
  class
- Fixed a potential memory corruption bug
- Added code to allow the rtsp code to notify the transport about how many
  ABD packets are being requested.


Index: rdttran.cpp
===================================================================
RCS file: /cvsroot/protocol/transport/rdt/rdttran.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- rdttran.cpp	24 Nov 2004 21:34:31 -0000	1.7
+++ rdttran.cpp	16 Dec 2004 19:10:05 -0000	1.8
@@ -301,14 +301,7 @@
 void
 TNGUDPTransport::Done()
 {
-    for (int i = 0; i < MAX_ABD_PROBPKT; i++)
-    {
-        if (!m_pABDProbPktInfo[i])
-        {
-            break;
-        }
-        HX_DELETE(m_pABDProbPktInfo[i]);
-    }
+    destroyABDPktInfo();
 
     KillAck();
     HX_RELEASE(m_pACKCallback);
@@ -2364,7 +2357,6 @@
     BYTE* pOff = NULL;
     BYTE* pData = pBuffer->GetBuffer() + *pPos;
     UINT32 ulTS = 0;
-    double dwResult = 0;
     IHXTimeStampedBuffer* pTSBuffer = NULL;
     IHXAutoBWDetectionAdviseSink* pSink = NULL;
 
@@ -2393,40 +2385,10 @@
         HX_ASSERT(FALSE);
     }
 
-    m_pABDProbPktInfo[m_nProbingPacketsReceived] = new ABD_PROBPKT_INFO;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->seq = pkt.seq_no;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->sendTime = pkt.timestamp;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->recvTime = ulTS;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->dwSize = pkt.length;
-
-    m_nProbingPacketsReceived++;
-
-    // XXX HP still need to handle loss case
-    if (m_nProbingPacketsReceived == DEFAULT_ABD_PROBPKT)
+    if (HXR_OK == res)
     {
-        dwResult = CalculateABD(1, UDPMode, &m_pABDProbPktInfo[0], m_nProbingPacketsReceived);
-
-        for (int i = 0; i < DEFAULT_ABD_PROBPKT; i++)
-        {
-            if (!m_pABDProbPktInfo[i])
-            {
-                break;
-            }
-            HX_DELETE(m_pABDProbPktInfo[i]);
-        }
-
-        if (dwResult > 0.0)
-        {
-            if (HXR_OK == m_pResp->QueryInterface(IID_IHXAutoBWDetectionAdviseSink, (void**)&pSink))
-            {
-                pSink->AutoBWDetectionDone(HXR_OK, (UINT32)dwResult);
-            }
-            HX_RELEASE(pSink);
-        }
-        else
-        {
-            res = HXR_FAILED;
-        }
+        res = handleABDPktInfo(UDPMode, pkt.seq_no, pkt.timestamp, ulTS, 
+                               pkt.length);
     }
 
     return res;
@@ -3943,9 +3905,7 @@
     BYTE* pOff = NULL;
     BYTE* pData = pBuffer->GetBuffer() + *pPos;
     UINT32 ulTS = 0;
-    double dwResult = 0;
-    IHXTimeStampedBuffer* pTSBuffer = NULL;
-    IHXAutoBWDetectionAdviseSink* pSink = NULL;
+    IHXTimeStampedBuffer* pTSBuffer = NULL;    
 
     if ((pOff = pkt.unpack(pData, *pLen)) != 0)
     {
@@ -3972,40 +3932,10 @@
         HX_ASSERT(FALSE);
     }
 
-    m_pABDProbPktInfo[m_nProbingPacketsReceived] = new ABD_PROBPKT_INFO;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->seq = pkt.seq_no;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->sendTime = pkt.timestamp;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->recvTime = ulTS;
-    m_pABDProbPktInfo[m_nProbingPacketsReceived]->dwSize = pkt.length;
-
-    m_nProbingPacketsReceived++;
-
-    // XXX HP still need to handle loss case
-    if (m_nProbingPacketsReceived == DEFAULT_ABD_PROBPKT)
+    if (HXR_OK == res)
     {
-        dwResult = CalculateABD(1, TCPMode, &m_pABDProbPktInfo[0], m_nProbingPacketsReceived);
-
-        for (int i = 0; i < DEFAULT_ABD_PROBPKT; i++)
-        {
-            if (!m_pABDProbPktInfo[i])
-            {
-                break;
-            }
-            HX_DELETE(m_pABDProbPktInfo[i]);
-        }
-
-        if (dwResult > 0.0)
-        {
-            if (HXR_OK == m_pResp->QueryInterface(IID_IHXAutoBWDetectionAdviseSink, (void**)&pSink))
-            {
-                pSink->AutoBWDetectionDone(HXR_OK, (UINT32)dwResult);
-            }
-            HX_RELEASE(pSink);
-        }
-        else
-        {
-            res = HXR_FAILED;
-        }
+        res = handleABDPktInfo(TCPMode, pkt.seq_no, pkt.timestamp, ulTS, 
+                               pkt.length);
     }
 
     return res;
@@ -4120,14 +4050,7 @@
 void
 TNGTCPTransport::Done()
 {
-    for (int i = 0; i < MAX_ABD_PROBPKT; i++)
-    {
-        if (!m_pABDProbPktInfo[i])
-        {
-            break;
-        }
-        HX_DELETE(m_pABDProbPktInfo[i]);
-    }
+    destroyABDPktInfo();
 
     HX_RELEASE(m_pPacketFilter);
 }



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

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