browserutilities/downloadmgr/DownloadMgrClntSrv/src/DownloadMgrSrvSession.cpp
branchRCL_3
changeset 94 919f36ff910f
parent 93 79859ed3eea9
--- a/browserutilities/downloadmgr/DownloadMgrClntSrv/src/DownloadMgrSrvSession.cpp	Tue Aug 31 16:17:46 2010 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrClntSrv/src/DownloadMgrSrvSession.cpp	Wed Sep 01 12:28:30 2010 +0100
@@ -16,15 +16,14 @@
 *
 */
 
-
 // INCLUDE FILES
 #include "DownloadMgrLogger.h"
 #include "DownloadMgrServer.h"
 #include "DownloadMgrDef.h"
 #include "DownloadMgrEventQueue.h"
 
-#include <HttpClientAppInstance.h>
-#include <HttpDownload.h>
+#include "HttpClientAppInstance.h"
+#include "HttpDownload.h"
 #include <e32svr.h>
 #include <basched.h>
 
@@ -146,6 +145,7 @@
     if( iComplete || ( KErrNone != err ) )
         {
         // Only the syncron requests has to be completed here!
+        if ((!aMessage.IsNull()) && (!CurrentMessage().IsNull())  )
 	    aMessage.Complete( err );
         }
 	}
@@ -174,6 +174,11 @@
     // check for session-relative requests
 	switch( aMessage.Function() )
 		{
+	    case EHttpDownMgrNumOfSubSessions:
+	         {
+	         GetNumberOfSubsession();
+	         return;
+	         }
         case EHttpDownloadMgrInitialize:
             {
             InitializeL();
@@ -312,6 +317,24 @@
     }
 
 // ---------------------------------------------------------
+// CDownloadMgrSession::GetNumberOfSubsession
+// ---------------------------------------------------------
+//
+void CDownloadMgrSession::GetNumberOfSubsession()
+    {    
+    TInt32 value(0);   
+    for( TInt i = 0; i < iObjectIx->Count(); i++ ){
+        CDownloadSubSession* downloadSess 
+                    = ( CDownloadSubSession* )(*iObjectIx)[i];
+         if( downloadSess != NULL ){
+         value++;  
+         }
+        }
+    TPckg<TInt32> pckg( value );
+    Write( 0, CurrentMessage(), pckg );    
+    }
+
+// ---------------------------------------------------------
 // CDownloadMgrSession::InitializeL
 // ---------------------------------------------------------
 //
@@ -332,8 +355,9 @@
     CArrayPtrFlat<CHttpDownload>* currentDownloads = iClientAppInstance->DownloadsL();
 	TPckg<TInt> countPckg( currentDownloads->Count() );
 	TPckg<TInt> sessionId( iSessionId );
-
+  if (!CurrentMessage().IsNull())
     Write( 1, CurrentMessage(), countPckg );
+  if (!CurrentMessage().IsNull())
     Write( 3, CurrentMessage(), sessionId );
 
     CLOG_NAME_2( _L("Session_%x_%x"), uidPckg().iUid, iSessionId );