|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 #include "senasynctimeout.h" |
|
27 #include <http.h> |
|
28 #include "sentxnstate.h" |
|
29 |
|
30 CSenAsyncTimeOut::CSenAsyncTimeOut(CSenTxnState* aTxnState) : |
|
31 CTimer(EPriorityStandard), |
|
32 iTxnState(aTxnState) |
|
33 // Standard priority |
|
34 { |
|
35 } |
|
36 |
|
37 CSenAsyncTimeOut* CSenAsyncTimeOut::NewLC(CSenTxnState* aTxnState) |
|
38 { |
|
39 CSenAsyncTimeOut* self = new ( ELeave ) CSenAsyncTimeOut(aTxnState); |
|
40 CleanupStack::PushL(self); |
|
41 self->ConstructL(); |
|
42 return self; |
|
43 } |
|
44 |
|
45 CSenAsyncTimeOut* CSenAsyncTimeOut::NewL(CSenTxnState* aTxnState) |
|
46 { |
|
47 CSenAsyncTimeOut* self = CSenAsyncTimeOut::NewLC(aTxnState); |
|
48 CleanupStack::Pop(); // self; |
|
49 return self; |
|
50 } |
|
51 |
|
52 void CSenAsyncTimeOut::ConstructL() |
|
53 { |
|
54 CTimer::ConstructL(); |
|
55 CActiveScheduler::Add(this); |
|
56 } |
|
57 |
|
58 CSenAsyncTimeOut::~CSenAsyncTimeOut() |
|
59 { |
|
60 Cancel(); // Cancel any request, if outstanding |
|
61 } |
|
62 |
|
63 |
|
64 void CSenAsyncTimeOut::StartL(TInt aTimeOutSec) |
|
65 { |
|
66 Cancel(); // Cancel any request, just to be sure |
|
67 After(aTimeOutSec * 1000000); // Set for later |
|
68 } |
|
69 |
|
70 void CSenAsyncTimeOut::RunL() |
|
71 { |
|
72 //cancel trans |
|
73 iTxnState->Cancel(); |
|
74 iTxnState->ResponseErrorL(KErrTimedOut); |
|
75 } |
|
76 |
|
77 TInt CSenAsyncTimeOut::RunError(TInt aError) |
|
78 { |
|
79 return aError; |
|
80 } |