[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-common-cvs
Subject: [Common-cvs] netio/platform/symbian hxsymbiansocket.cpp, 1.1.2.5,
From: anugrahk () helixcommunity ! org
Date: 2009-12-22 5:16:16
Message-ID: 200912220516.nBM5GYca017515 () mailer ! progressive-comp ! com
[Download RAW message or body]
Update of /cvsroot/common/netio/platform/symbian
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv28038
Modified Files:
Tag: hxclient_2_2_1_cayennes
hxsymbiansocket.cpp
Log Message:
"Nokia submits this code under the terms of a commercial contribution agreement with \
RealNetworks, and I am authorized to contribute this code under said agreement”
Modified By: ext-anugrah.2.kashari@nokia.com
Review By: Gupta Ashish.As (Nokia-D/Dallas)
Eric Hyche [ehyche@real.com]
TSW-ID: ESLM-7YEAVG
Date : 17 /12/2009
Project: SymbianMmf_wm
Synopsis: MCL_Fusion: Crash "Application closed: MMPControllerProxyServer" occurs \
when streaming a video only Real Media content (attached video_only.zip) via an \
excerpt link.
Overview : At present maximum size for UDP datagram is fixed at 4096 \
(UDP_READ_SIZE_READCONTINUATION) byte. In this case, some of the UDP datagram are \
more than 4096 bytes. Therefore, RTSP client was reading partial datagram with \
maximum buffer size of 4096 byte. After each read operation it assumes that it is \
complete packet and was send for further processing. As UDP datagram is read in \
continuation (KSockReadContinuation), next time RSocket::RecvFrom() is called it will \
return the remaining data (with limit of 4096 bytes and repeat if necessary). But \
RTSP client considers each read operation as a complete packet therefore offset \
calculation goes for a toss and it crashes with kern exec 3.
Fix: Added code to read UDP socket in loop.
Changes
1. API added to get remaining data in UDP socket \
CHXSymbianSocketReader::MoreDataAvailable() 2. \
CHXSymbianSocketReader::Read() use other socket.RecvFrom() 3. \
CHXSymbianSocket::OnRead() loop added for UDP socket. We are reusing the 4096 byte \
buffer allocated before for issuing subsequent read.
Files modified & changes for 223Cays, 221Cays, 210Cays , Brizo420 and Head :
/cvsroot/ common/netio/pub/platform/symbian/hxsymbiansocket.h
/cvsroot/ common /netio/platform/symbian/hxsymbiansocket.cpp
Image Size and Heap Use impact: No major impact
Module Release testing (STIF) : YES
Test case(s) Added : No
Memory leak check performed : Passed, No additional leaks introduced.
Platforms and Profiles Build Verified: helix-client-s60-50-mmf-mdf-dsp \
Platforms and Profiles Functionality verified: armv5
Branch : 210Cays, 221Cays , 223Cays , Brizo420 & Head :
Index: hxsymbiansocket.cpp
===================================================================
RCS file: /cvsroot/common/netio/platform/symbian/hxsymbiansocket.cpp,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.5.2.1
diff -u -d -r1.1.2.5 -r1.1.2.5.2.1
--- hxsymbiansocket.cpp 23 Jan 2008 16:19:02 -0000 1.1.2.5
+++ hxsymbiansocket.cpp 22 Dec 2009 05:16:13 -0000 1.1.2.5.2.1
@@ -86,6 +86,9 @@
,m_uReadSize(0)
,m_pUdpConnectAddr(NULL)
,m_bInitialized(FALSE)
+ ,m_bReadingPendingBytes(FALSE)
+ ,m_pPendingUDPReadBuf(NULL)
+ ,m_uPendingUDPReadBufSize(0)
{
HX_ADDREF(m_pNetSvc);
HX_ASSERT(m_pContext);
@@ -112,6 +115,7 @@
HX_RELEASE(m_pContext);
HX_RELEASE(m_pReadersBuf);
HX_RELEASE(m_pDataBuf);
+ HX_RELEASE(m_pPendingUDPReadBuf);
HX_DELETE(m_pUdpConnectAddr);
if (m_pAPResponse)
{
@@ -810,9 +814,72 @@
if(hxr == HXR_OK)
{
HX_ASSERT(!m_pDataBuf);
- TransferBuffer(m_pReadersBuf, m_pDataBuf, bytes);
+
+ if(GetType() == HX_SOCK_TYPE_UDP )
+ {
+ UINT32 pendingBytes = 0;
+ pendingBytes = m_pReader->MoreDataAvailable();
+ if(pendingBytes)
+ {
+ // For UDP datagram size greater than 4096 bytes \
(UDP_READ_SIZE_READCONTINUATION), + // pendingBytes will be greater \
than 0. Total size of UDP datagram is equal to sum + // of \
pendingBytes and bytes. We create a temporary buffer where we will keep + \
// appending UDP datagram. The buffer + // is created once and for \
every subsequent read, data is simply appended. + UINT32 totalBytes = \
pendingBytes + bytes; + if(!m_bReadingPendingBytes)
+ {
+ hxr = CreateReadBuffer(m_pPendingUDPReadBuf, totalBytes);
+ m_uPendingUDPReadBufSize = 0;
+ }
+ if (HXR_OK == hxr)
+ {
+ memcpy(m_pPendingUDPReadBuf->GetBuffer()+ \
m_uPendingUDPReadBufSize , m_pReadersBuf->GetBuffer(), bytes); + \
m_uPendingUDPReadBufSize += bytes; + // reuse same allocate buffer
+ m_ulSocketTaskFlags |= HX_SOCK_EVENT_READ;
+ m_pReader->Read(m_sock, m_pReadersBuf, &m_readFrom);
+ m_bReadingPendingBytes = TRUE;
+ }
+ }
+ else
+ { // This is the case when complete UDP datagram is read. If \
m_bReadingPendingBytes + // was not set to TRUE it mean that UDP \
datagram was <= UDP_READ_SIZE_READCONTINUATION + \
if(!m_bReadingPendingBytes) // For UDP datagram <= UDP_READ_SIZE_READCONTINUATION + \
{ + TransferBuffer(m_pReadersBuf, m_pDataBuf, bytes);
+ }
+ else // For UDP datagram > UDP_READ_SIZE_READCONTINUATION
+ { // Append the rest of data to the buffer and transfer this \
buffer for further processing + \
memcpy(m_pPendingUDPReadBuf->GetBuffer() + m_uPendingUDPReadBufSize , \
m_pReadersBuf->GetBuffer(), bytes); + m_uPendingUDPReadBufSize += \
bytes; + TransferBuffer(m_pPendingUDPReadBuf, m_pDataBuf, \
m_pPendingUDPReadBuf->GetSize()); + m_bReadingPendingBytes = \
FALSE; + HX_RELEASE(m_pReadersBuf); // Release the buffer
+ }
+
+ }
+
+ }
+ else
+ {
+ TransferBuffer(m_pReadersBuf, m_pDataBuf, bytes);
+ }
}
- if(HX_SOCK_EVENT_READ & m_ulEventMask)
+ else
+ {
+ // In case any error occured during reading pending bytes transfer the \
accumulated data + // for further processing.
+ if(m_bReadingPendingBytes)
+ {
+ TransferBuffer(m_pPendingUDPReadBuf, m_pDataBuf, \
m_uPendingUDPReadBufSize); + m_bReadingPendingBytes = FALSE;
+ HX_RELEASE(m_pReadersBuf); // Release the buffer
+ }
+ }
+
+ // When reading UDP datagram > UDP_READ_SIZE_READCONTINUATION byte, do not send \
any event. + if(!m_bReadingPendingBytes && (HX_SOCK_EVENT_READ & m_ulEventMask) \
) {
m_pResponse->EventPending(HX_SOCK_EVENT_READ, hxr);
}
@@ -1224,7 +1291,8 @@
if(fromAddr)
{
// passing ref. Saves extra copy and possible extra return path.
- socket.RecvFrom(m_bufDes, *fromAddr, KSockReadContinuation, iStatus);
+ m_amountRead = 0; // Reset the count
+ socket.RecvFrom(m_bufDes, *fromAddr, KSockReadContinuation, iStatus, \
m_amountRead); }
else
{
@@ -1271,6 +1339,12 @@
}
+UINT32 CHXSymbianSocketReader::MoreDataAvailable()
+{
+ UINT32 size = m_amountRead();
+ return size;
+}
+
void
CHXSymbianSocketReader::DoCancel()
{
_______________________________________________
Common-cvs mailing list
Common-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/common-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic