equal
deleted
inserted
replaced
21 #include "ipsplgheaders.h" |
21 #include "ipsplgheaders.h" |
22 |
22 |
23 // Constants and defines |
23 // Constants and defines |
24 const TInt KFetchOpPriority = CActive::EPriorityStandard; |
24 const TInt KFetchOpPriority = CActive::EPriorityStandard; |
25 const TInt KIpsAttaFetchProgressReportInterval = 1000000; // 1 sec |
25 const TInt KIpsAttaFetchProgressReportInterval = 1000000; // 1 sec |
|
26 const TInt KIpsAttaFetchRetryInterval = 1000000; // 1 sec |
|
27 const TInt KIpsAttaFetchRetryCount = 30; |
26 |
28 |
27 // ---------------------------------------------------------------------------- |
29 // ---------------------------------------------------------------------------- |
28 // ---------------------------------------------------------------------------- |
30 // ---------------------------------------------------------------------------- |
29 CIpsFetchProgReport* CIpsFetchProgReport::NewL( |
31 CIpsFetchProgReport* CIpsFetchProgReport::NewL( |
30 CIpsPlgImap4FetchAttachmentOp& aAttaOp ) |
32 CIpsPlgImap4FetchAttachmentOp& aAttaOp ) |
155 iFunctionId(aFunctionId), |
157 iFunctionId(aFunctionId), |
156 iRetryCount( 0 ) |
158 iRetryCount( 0 ) |
157 { |
159 { |
158 FUNC_LOG; |
160 FUNC_LOG; |
159 iService = aService; |
161 iService = aService; |
|
162 iRetryTimer.CreateLocal(); |
160 } |
163 } |
161 |
164 |
162 // ---------------------------------------------------------------------------- |
165 // ---------------------------------------------------------------------------- |
163 // ---------------------------------------------------------------------------- |
166 // ---------------------------------------------------------------------------- |
164 CIpsPlgImap4FetchAttachmentOp::~CIpsPlgImap4FetchAttachmentOp() |
167 CIpsPlgImap4FetchAttachmentOp::~CIpsPlgImap4FetchAttachmentOp() |
165 { |
168 { |
166 FUNC_LOG; |
169 FUNC_LOG; |
|
170 iRetryTimer.Close(); |
167 delete iSelection; |
171 delete iSelection; |
168 delete iProgReport; |
172 delete iProgReport; |
169 } |
173 } |
170 |
174 |
171 // ---------------------------------------------------------------------------- |
175 // ---------------------------------------------------------------------------- |
236 } |
240 } |
237 iRetryCount = 0; |
241 iRetryCount = 0; |
238 DoFetchAttachmentL(); |
242 DoFetchAttachmentL(); |
239 break; |
243 break; |
240 } |
244 } |
|
245 case EStateWaiting: |
|
246 { |
|
247 DoFetchAttachmentL(); |
|
248 break; |
|
249 } |
241 case EStateFetching: |
250 case EStateFetching: |
242 { |
251 { |
243 delete iProgReport; |
252 delete iProgReport; |
244 iProgReport = NULL; |
253 iProgReport = NULL; |
245 |
254 |
246 TInt err = iStatus.Int(); |
255 TInt err = iStatus.Int(); |
247 |
256 |
248 // If the server was busy, try again a few times. |
257 // If the server was busy, try again after a short delay, up to |
249 if ( err == KErrServerBusy && iRetryCount < 3 ) |
258 // some retry limit. |
|
259 if ( err == KErrServerBusy && iRetryCount < KIpsAttaFetchRetryCount ) |
250 { |
260 { |
251 iRetryCount++; |
261 iRetryCount++; |
252 DoFetchAttachmentL(); |
262 INFO_1( "CIpsPlgImap4FetchAttachmentOp::DoRunL: iRetryCount = %d", iRetryCount ); |
|
263 iState = EStateWaiting; |
|
264 iStatus = KRequestPending; |
|
265 iRetryTimer.After( iStatus, KIpsAttaFetchRetryInterval ); |
|
266 SetActive(); |
253 } |
267 } |
254 else |
268 else |
255 { |
269 { |
256 if( err != KErrNone && iOperation ) |
270 if( err != KErrNone && iOperation ) |
257 { |
271 { |