userlibandfileserver/fileserver/sfile/sf_plugin_man.cpp
branchRCL_3
changeset 147 bbf8bed59bcb
parent 15 4122176ea935
child 256 c1f20ce4abcf
equal deleted inserted replaced
117:5b5d147c7838 147:bbf8bed59bcb
   743 	// Iterate through all plugins, cancelling outstanding session requests
   743 	// Iterate through all plugins, cancelling outstanding session requests
   744 	aRequest->Set(CancelPluginOp, aSession);
   744 	aRequest->Set(CancelPluginOp, aSession);
   745 
   745 
   746 	FsPluginManager::LockChain();
   746 	FsPluginManager::LockChain();
   747 	TInt count = FsPluginManager::ChainCount();
   747 	TInt count = FsPluginManager::ChainCount();
       
   748 	TInt oldCount = count;
   748 	TInt i;
   749 	TInt i;
   749 	for(i=0; i<count; i++)
   750 	for(i=0; i<count; i++)
   750 	    {
   751 	    {
   751 	    CFsPlugin* plugin = NULL;
   752 	    CFsPlugin* plugin = NULL;
   752 	    User::LeaveIfError(FsPluginManager::Plugin(plugin, i));
   753 	    (void) FsPluginManager::Plugin(plugin, i); // (void) as chain is locked.
   753 	    __ASSERT_DEBUG(plugin, User::Leave(KErrNotFound));
   754 	    __ASSERT_DEBUG(plugin, User::Leave(KErrNotFound));
   754 	    aRequest->iCurrentPlugin = plugin;
   755 	    aRequest->iCurrentPlugin = plugin;
   755 	    aRequest->Status() = KRequestPending;
   756 	    aRequest->Status() = KRequestPending;
   756 	    aRequest->Dispatch();
   757 	    aRequest->Dispatch();
   757 	    //Cancel is delivered to the front of the request queue
   758 	    //Cancel is delivered to the front of the request queue
   759 	    FsPluginManager::UnlockChain();
   760 	    FsPluginManager::UnlockChain();
   760 	    User::WaitForRequest(aRequest->Status());
   761 	    User::WaitForRequest(aRequest->Status());
   761 	    FsPluginManager::LockChain();
   762 	    FsPluginManager::LockChain();
   762 	    __ASSERT_ALWAYS(aRequest->Status().Int()==KErrNone||aRequest->Status().Int()==KErrCancel,Fault(ESessionDisconnectThread2));
   763 	    __ASSERT_ALWAYS(aRequest->Status().Int()==KErrNone||aRequest->Status().Int()==KErrCancel,Fault(ESessionDisconnectThread2));
   763 	    count = FsPluginManager::ChainCount();
   764 	    count = FsPluginManager::ChainCount();
       
   765 	    //If a plugin was removed whilst the chain was unlocked we need to make sure we don't skip any plugins
       
   766 	    if(count != oldCount)
       
   767 	        {
       
   768 	        i=0;
       
   769 	        oldCount = count;
       
   770 	        }
   764 	    }
   771 	    }
   765 	FsPluginManager::UnlockChain();
   772 	FsPluginManager::UnlockChain();
   766 	
   773 	
   767 //	RDebug::Print(_L("FsPluginManager::CompleteSessionRequests - CSRs"));
   774 //	RDebug::Print(_L("FsPluginManager::CompleteSessionRequests - CSRs"));
   768 	iScheduler->CompleteSessionRequests(aSession, aValue);
   775 	iScheduler->CompleteSessionRequests(aSession, aValue);