1 /* |
1 /* |
2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
124 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
125 // StartOperation |
125 // StartOperation |
126 // --------------------------------------------------------------------------- |
126 // --------------------------------------------------------------------------- |
127 // |
127 // |
128 TInt CCatalogsHttpSessionManager::StartOperation( |
128 TInt CCatalogsHttpSessionManager::StartOperation( |
129 MCatalogsHttpOperation* aOperation ) |
129 MCatalogsHttpOperation* aOperation, TBool aConnect ) |
130 { |
130 { |
131 DLTRACEIN(("")); |
131 DLTRACEIN(("")); |
132 DLINFO( ("Operation ID: %i, Type: %i", |
132 DLINFO( ("Operation ID: %i, Type: %i", |
133 aOperation->OperationId().Id(), aOperation->OperationType() ) ); |
133 aOperation->OperationId().Id(), aOperation->OperationType() ) ); |
134 DASSERT( aOperation ); |
134 DASSERT( aOperation ); |
138 DLINFO(("Running operations: %d, transactions: %d, general: %d", |
138 DLINFO(("Running operations: %d, transactions: %d, general: %d", |
139 iRunningOperations, iRunningTransactions, iRunningFromGeneral )); |
139 iRunningOperations, iRunningTransactions, iRunningFromGeneral )); |
140 |
140 |
141 // Make sure the download is removed from queue |
141 // Make sure the download is removed from queue |
142 RemoveFromQueue( aOperation ); |
142 RemoveFromQueue( aOperation ); |
143 |
143 |
144 TBool isRunning = EFalse; |
|
145 |
144 |
146 // Check if the operation can connect either by using the current AP |
145 // Check if the operation can connect either by using the current AP |
147 // or by opening a new one |
146 // or by opening a new one |
148 TRAPD( err, isRunning = ConnectL( *aOperation ) ); |
147 if ( aConnect ) |
149 if ( err != KErrNone ) |
148 { |
150 { |
149 TBool isRunning = EFalse; |
151 DLTRACEOUT(("Error: %d, err")); |
150 TRAPD( err, isRunning = ConnectL( *aOperation ) ); |
152 return err; |
151 if ( err != KErrNone ) |
153 } |
152 { |
154 |
153 DLTRACEOUT(("Error: %d, err")); |
155 if ( !isRunning ) |
154 return err; |
156 { |
155 } |
157 DLTRACEOUT(("Not running, adding to queue")); |
156 if ( !isRunning ) |
158 return AddToQueue( aOperation ); |
157 { |
159 } |
158 DLTRACEOUT(("Not running, adding to queue")); |
160 |
159 return AddToQueue( aOperation ); |
161 // Check whether operation belongs to general queue or not |
160 } |
|
161 } |
|
162 // Check whether operation belongs to general queue or not |
162 if ( aOperation->Config().Priority() > ECatalogsPriorityQueued ) |
163 if ( aOperation->Config().Priority() > ECatalogsPriorityQueued ) |
163 { |
164 { |
164 // non-general queues |
165 // non-general queues |
165 if ( iRunningOperations < KMaxConcurrentOperations ) |
166 if ( iRunningOperations < KMaxConcurrentOperations ) |
166 { |
167 { |