harvester/blacklistclient/src/blacklistclient.cpp
changeset 23 33ae025ac1e8
parent 21 50bf9db68373
child 25 8e4539ab1889
--- a/harvester/blacklistclient/src/blacklistclient.cpp	Fri Apr 16 15:23:55 2010 +0300
+++ b/harvester/blacklistclient/src/blacklistclient.cpp	Mon May 03 12:55:01 2010 +0300
@@ -43,6 +43,7 @@
     iBlacklistMemoryTable.ResetAndDestroy();
     iBlacklistMemoryTable.Close();
 	iBlacklistChunk.Close();
+	iFs.Close();
 
     WRITELOG( "RBlacklistClient::~RBlacklistClient - end" );
     }
@@ -56,8 +57,15 @@
     WRITELOG( "RBlacklistClient::Connect - begin" );
 
     iSessionOk = EFalse;
+    
+    TInt error = iFs.Connect();
+    
+    if( error != KErrNone )
+        {
+        return error;
+        }
       
-    TInt error = StartServer();
+    error = StartServer();
 
     if ( error == KErrNone || error == KErrAlreadyExists )
         {
@@ -69,6 +77,10 @@
         {
         iSessionOk = ETrue;
         }
+    else
+        {
+        iFs.Close();
+        }
     
     WRITELOG( "RBlacklistClient::Connect - end" );
 
@@ -116,7 +128,7 @@
         }
 
     User::WaitForRequest( status );
-    error = server.ExitType() == EExitPanic ? KErrGeneral : status.Int();
+    error = server.ExitType() == EExitPanic ? KErrCommsBreak : status.Int();
     server.Close();
 
     WRITELOG( "RBlacklistClient::StartServer - end" );
@@ -273,21 +285,37 @@
 // RBlacklistClient::IsBlacklistedL()
 // ---------------------------------------------------------------------------
 //
-EXPORT_C TBool RBlacklistClient::IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime aLastModifiedTime )
+EXPORT_C TBool RBlacklistClient::IsBlacklistedL( const TDesC& aUri, TUint32 aMediaId, TTime /*aLastModifiedTime*/ )
     {
     WRITELOG( "RBlacklistClient::IsBlacklistedL - begin" );
 
+    if ( !iSessionOk )
+        {
+        return EFalse;
+        }
+    
     const TInt index = GetListIndex( aUri, aMediaId );
     if ( index >= 0 )
         {
+        TEntry entry;
+        const TInt errorcode = iFs.Entry( aUri, entry );
+        
+        if ( errorcode != KErrNone )
+            {
+            return EFalse;
+            }
+        
+        TTime fileLastModified( 0 );
+        fileLastModified = entry.iModified;
+    
         TInt64 modified( 0 );
         modified = iBlacklistMemoryTable[index]->Modified();
         
         if( modified > 0 )
             {
-            if ( modified == aLastModifiedTime.Int64() )
+            if ( modified == fileLastModified.Int64() )
                 {
-                WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is different" );
+                WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is the same" );
                 return ETrue;
                 }
             else