This release addresses the following: MSRP_FrameWork tip
authorPetteri Saari <petteri.saari@digia.com>
Thu, 02 Dec 2010 15:23:48 +0200
branchMSRP_FrameWork
changeset 60 7634585a4347
parent 59 b365c991829c
This release addresses the following: - Multiple concurrent file transfer bug fixes. i.e. one device is concurrently receiving multiple files from multiple devices
Msrp/MsrpClient/src/CMSRPSessionImplementation.cpp
Msrp/MsrpServer/src/CMSRPConnectionManager.cpp
Msrp/MsrpServer/src/CMSRPMessageHandler.cpp
Msrp/MsrpServer/src/CMSRPMsgParser.cpp
Msrp/MsrpServer/src/CMSRPServerSubSession.cpp
Msrp/MsrpServer/src/CMSRPWriter.cpp
Msrp/MsrpServer/src/TStates.cpp
--- a/Msrp/MsrpClient/src/CMSRPSessionImplementation.cpp	Fri Nov 26 12:09:49 2010 +0200
+++ b/Msrp/MsrpClient/src/CMSRPSessionImplementation.cpp	Thu Dec 02 15:23:48 2010 +0200
@@ -241,7 +241,7 @@
 void CMSRPSessionImplementation::HandleIncomingMessageL(
     const TDesC8& aIncomingMessage, TInt aStatus )
     {
-    MSRPLOG( "CMSRPSessionImplementation::HandleIncomingMessageL enter" )
+    MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL enter, length %d", aIncomingMessage.Length() )
 
     // the incoming buffer must be internalized
     RDesReadStream readStream( aIncomingMessage );
@@ -249,7 +249,9 @@
     if ( CMSRPMessage::IsMessage( aIncomingMessage ) )
         {
         CMSRPMessage* message = NULL;
-        message = CMSRPMessage::InternalizeL( readStream );
+        TRAPD( err, message = CMSRPMessage::InternalizeL( readStream ) );
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL enter internalize err = %d", err )
+        User::LeaveIfError( err );
         CleanupStack::PushL(message);
         MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, content = %d", message->IsContent()  )
         MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, FN = %S", &message->GetFileName()  )
@@ -293,7 +295,10 @@
         }
     else if ( CMSRPReport::IsReport( aIncomingMessage ) )
         {
-        CMSRPReport* report = CMSRPReport::InternalizeL( readStream );
+        CMSRPReport* report = NULL;
+        TRAPD( err, report = CMSRPReport::InternalizeL( readStream ) );
+        MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL enter internalize err = %d", err )
+        User::LeaveIfError( err );
         MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, status = %d", report->StatusHeader()->StatusCode() )
         MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, startpos = %d", report->ByteRangeHeader()->StartPosition() )
         MSRPLOG2( "CMSRPSessionImplementation::HandleIncomingMessageL, endpos = %d", report->ByteRangeHeader()->EndPosition() )
@@ -308,6 +313,7 @@
         }
     else
         {
+        MSRPLOG( "CMSRPSessionImplementation::HandleIncomingMessageL enter INVALID MESSAGE RECEIVED!" )
         User::Leave( KErrArgument );
         }
     
--- a/Msrp/MsrpServer/src/CMSRPConnectionManager.cpp	Fri Nov 26 12:09:49 2010 +0200
+++ b/Msrp/MsrpServer/src/CMSRPConnectionManager.cpp	Thu Dec 02 15:23:48 2010 +0200
@@ -332,6 +332,7 @@
          {
          aAddress = TInetAddr::Cast( entry().iAddr );
          }
+    iHostResolver.Close();
     //CleanupStack::PopAndDestroy( );
     MSRPLOG( "CMSRPConnectionManager::ResolveIPAddressL exit" )
     }
--- a/Msrp/MsrpServer/src/CMSRPMessageHandler.cpp	Fri Nov 26 12:09:49 2010 +0200
+++ b/Msrp/MsrpServer/src/CMSRPMessageHandler.cpp	Thu Dec 02 15:23:48 2010 +0200
@@ -320,7 +320,21 @@
             }
         else
             {
-            AppendMessageToFileL( aContent );
+            if( iBuffer.Length() )
+                {
+                HBufC8* combined = HBufC8::NewLC( iBuffer.Length() + aContent.Length() );
+                TPtr8 ptr = combined->Des();
+                ptr = iBuffer;
+                ptr.Append( aContent );
+                // must write to file
+                WriteMessageToFileL( ptr );
+                CleanupStack::PopAndDestroy( ); // combined
+                iBuffer.Zero();
+                }
+            else
+                {
+                AppendMessageToFileL( aContent );
+                }
             }
         }    
     MSRPLOG( "CMSRPMessageHandler::AddContentL exit" )
@@ -465,7 +479,7 @@
     if ( iActiveMsgType == EMSRPResponse )
         {
         // currently sending a response
-        MSRPLOG( "CMSRPMessageHandler::SendReportL sendin a response..." )
+        MSRPLOG( "CMSRPMessageHandler::SendReportL response sending in progress, do nothing" )
         return sendReport;
         }
     iMSRPMessageObserver = aMessageObserver;
--- a/Msrp/MsrpServer/src/CMSRPMsgParser.cpp	Fri Nov 26 12:09:49 2010 +0200
+++ b/Msrp/MsrpServer/src/CMSRPMsgParser.cpp	Thu Dec 02 15:23:48 2010 +0200
@@ -100,7 +100,8 @@
     while (match == EFullMatch) 
     //while (ret == TRUE)/*parse all parseable data*/
         {    
-        MSRPLOG( "CMSRPMsgParser::ParseL enter" )    
+        MSRPLOG2( "CMSRPMsgParser::ParseL enter,count= %d", iParseBuffers.Count() )    
+        MSRPLOG2( "CMSRPMsgParser::ParseL enter,state = %d", iState )    
         if(!iParseBuffers.Count())
 		{
 			MSRPLOG( "CMSRPMsgParser::ParseL exit" ) 
@@ -114,6 +115,13 @@
             }   
         
         TInt matchPos( 0 );
+        #ifdef _DEBUG
+        TBuf<100> koe;
+        koe.Copy( iParseBuffers[0]->Ptr().Left( 100 ) );
+        MSRPLOG2( "ST=%S", &koe )    
+        koe.Copy( iParseBuffers[0]->Ptr().Right( 100 ) );
+        MSRPLOG2( "ST=%S", &koe )
+        #endif
         match = FindToken(iParseBuffers[0]->Ptr(),token,matchPos);    
         if(match == EFullMatch)
             {
--- a/Msrp/MsrpServer/src/CMSRPServerSubSession.cpp	Fri Nov 26 12:09:49 2010 +0200
+++ b/Msrp/MsrpServer/src/CMSRPServerSubSession.cpp	Thu Dec 02 15:23:48 2010 +0200
@@ -478,6 +478,11 @@
     // Extract the data and complete the iIncommingMessageListner.
     MSRPLOG("CMSRPServerSubSession::sendMsgToClientL");
     CMSRPMessage* inMsg = incommingMsgHandler->GetIncomingMessage();
+    
+    if ( iCurrentlyReceivingMsgQ.FindElement( incommingMsgHandler ) )
+        {
+        iCurrentlyReceivingMsgQ.explicitRemove( incommingMsgHandler );
+        }
 
     if ( inMsg )
         {
--- a/Msrp/MsrpServer/src/CMSRPWriter.cpp	Fri Nov 26 12:09:49 2010 +0200
+++ b/Msrp/MsrpServer/src/CMSRPWriter.cpp	Thu Dec 02 15:23:48 2010 +0200
@@ -179,6 +179,7 @@
         MMSRPWriterObserver::TMsgStatus msgState = MMSRPWriterObserver::EComplete;
         msgState = iSendQueue[0]->WriteDoneL(status); 
         
+        MSRPLOG2( "CMSRPWriter::RunL enter, state = %d", msgState )    
         if( msgState != MMSRPWriterObserver::EPending && 
                 msgState != MMSRPWriterObserver::ESendingReport )    
             {
@@ -215,10 +216,13 @@
 //
 void CMSRPWriter::SendL()
     {
+    MSRPLOG( "->CMSRPWriter::SendL" )    
     TBool interruptSend = FALSE;
 
+    MSRPLOG2( "-> CMSRPWriter::SendL, count = %d", iSendQueue.Count() );    
     if(iSendQueue.Count())        
         {
+        MSRPLOG2( "-> CMSRPWriter::SendL, sending instance = %d", iSendQueue[0] );    
         MMSRPWriterObserver::TWriteStatus ret = MMSRPWriterObserver::EMsrpSocketWrite;
         
         if(iSendQueue.Count()>1)
--- a/Msrp/MsrpServer/src/TStates.cpp	Fri Nov 26 12:09:49 2010 +0200
+++ b/Msrp/MsrpServer/src/TStates.cpp	Thu Dec 02 15:23:48 2010 +0200
@@ -250,6 +250,7 @@
             }
         else
             {
+            MSRPLOG("TStateBase::handleClientListnerCancelL completing incoming listener"  );
             if( aContext->iIncommingMessageListner.Check() )
                 {
                 aContext->iIncommingMessageListner.Complete( KErrNone );
@@ -302,9 +303,14 @@
     
     switch(iConnectionEvent)
         {
-        case -1: // Error Scenario         
+        case -1: // Error Scenario    
+            {
+            // empty queue
+            MSRPLOG("TStateBase::handleConnectionStateChangedL, emptying queue " ); 
+            while ( aContext->iCurrentlyReceivingMsgQ.DeQueue() );
             state = handleConnectionErrorsL(aContext);
             break;
+            }
         
         case 1:
         case 2: