telephonyprotocols/rawipnif/src/Receiver.cpp
branchRCL_3
changeset 74 9200f38b1324
parent 66 07a122eea281
child 82 042fd2753b8f
--- a/telephonyprotocols/rawipnif/src/Receiver.cpp	Tue Sep 14 23:33:57 2010 +0300
+++ b/telephonyprotocols/rawipnif/src/Receiver.cpp	Wed Sep 15 13:30:43 2010 +0300
@@ -124,25 +124,36 @@
 	else
 	    {
         _LOG_L1C1(_L8("CReceiver: Data Packet Received"));
-    
-        iRMBufPacket.CreateL(iData);
-        
-        // Immediately execute new read request.
+
+        // Trap the leave to prevent the flow from being stopped if
+        // the MBuf pool is temporarily exhausted.    
+		TRAPD(err,iRMBufPacket.CreateL(iData));
+
+        // Immediately execute new read request, regardless of whether MBufs are
+        // exhausted or not.
         (iObserver.Bca())->Read(iStatus, iData);
     
         SetActive();
         
-        iRMBufPacket.Pack();
+        if (err == KErrNone)
+            {
+        	iRMBufPacket.Pack();
     
 #ifdef RAWIP_HEADER_APPENDED_TO_PACKETS
-        TUint16 protocolCode = iObserver.RemoveHeader(iRMBufPacket);
+        	TUint16 protocolCode = iObserver.RemoveHeader(iRMBufPacket);
 #else
-        TUint16 protocolCode = 0;
+        	TUint16 protocolCode = 0;
 #endif // RAWIP_HEADER_APPENDED_TO_PACKETS
     
-        // Process the packet
-        iObserver.GetObserver().Process(iRMBufPacket, protocolCode);
-        iRMBufPacket.Free();
+        	// Process the packet
+        	iObserver.GetObserver().Process(iRMBufPacket, protocolCode);
+        	iRMBufPacket.Free();
+			}
+		else
+			{
+			// If MBuff Allocation failed then dont process the packet, rely on layers above for recovery
+			_LOG_L2C2(_L8("CReceiver::RunL MBuff Allocation Failure [err=%d]"), err);
+			}
 	    }
 	}