ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp
branchRCL_3
changeset 8 e1b6206813b4
parent 0 8466d47a6819
child 16 4ce476e64c59
--- a/ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp	Tue Feb 02 00:02:40 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgimap4fetchattachmentop.cpp	Fri Feb 19 22:37:30 2010 +0200
@@ -152,7 +152,8 @@
     aFSRequestId),
     iSelection( NULL ),
     iGetMailInfo(aGetMailInfo),
-    iFunctionId(aFunctionId)
+    iFunctionId(aFunctionId),
+    iRetryCount( 0 )
     {
     FUNC_LOG;
     iService = aService;
@@ -233,6 +234,7 @@
                 CompleteObserver( KErrCouldNotConnect );
                 return;
                 }
+            iRetryCount = 0;
             DoFetchAttachmentL();
             break;
             }
@@ -243,13 +245,22 @@
             
             TInt err = iStatus.Int();
 
-            if( err != KErrNone && iOperation )
+            // If the server was busy, try again a few times.
+            if ( err == KErrServerBusy && iRetryCount < 3 )
                 {
-                iFetchErrorProgress = iOperation->ProgressL().AllocL();
+                iRetryCount++;
+                DoFetchAttachmentL();
                 }
-            
-            iState = EStateIdle;
-            CompleteObserver( err );
+            else
+                {
+                if( err != KErrNone && iOperation )
+                    {
+                    iFetchErrorProgress = iOperation->ProgressL().AllocL();
+                    }
+                
+                iState = EStateIdle;
+                CompleteObserver( err );
+                }
             break;
             }
         default: