1 /* |
1 /* |
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-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". |
168 // are ON event handlers will remove the connection from the array. |
168 // are ON event handlers will remove the connection from the array. |
169 iServer->Iap()->RemoveConnection( connInfo ); |
169 iServer->Iap()->RemoveConnection( connInfo ); |
170 } |
170 } |
171 else |
171 else |
172 { |
172 { |
173 TBool alreadyNotified( EFalse ); |
|
174 |
|
175 // This updates the correct 'iConnectionId' and 'iBearer' to connInfo |
173 // This updates the correct 'iConnectionId' and 'iBearer' to connInfo |
176 TInt ret = iServer->Iap()->GetDeleteNotifyStatus( connInfo, alreadyNotified ); |
174 TInt ret = iServer->Iap()->GetDeleteNotifyStatus( connInfo ); |
177 |
175 |
178 if ( ret == KErrNone ) |
176 if ( ret == KErrNone ) |
179 { |
177 { |
180 CSubConnUpDownNotifier* subConnUpDownNotifier = 0; |
178 CSubConnUpDownNotifier* subConnUpDownNotifier = 0; |
181 |
179 |
200 // because the current bearer has been lost (-36). MPM needs |
198 // because the current bearer has been lost (-36). MPM needs |
201 // a fresh list of available iaps on connection closure. |
199 // a fresh list of available iaps on connection closure. |
202 iServer->Iap()->EnableWlanScan(); |
200 iServer->Iap()->EnableWlanScan(); |
203 } |
201 } |
204 |
202 |
205 // Progress and subconn notifiers have died and no delete has been sent |
203 if ( subConnUpDownNotifier->LinkLayerClosed() ) |
206 subConnUpDownNotifier->SendDeletedEvent(); |
204 { |
|
205 // KLinkLayerClosed already received, finish with this connection |
|
206 subConnUpDownNotifier->SendDeletedEvent(); |
|
207 } |
207 } |
208 } |
208 else |
209 else |
209 { |
210 { |
210 // Delete has been sent. Just remove from internal table. |
211 // Delete has been sent. Just remove from internal table. |
211 iServer->Iap()->RemoveConnection( connInfo ); |
212 iServer->Iap()->RemoveConnection( connInfo ); |
596 if ( KErrNone == err ) |
597 if ( KErrNone == err ) |
597 { |
598 { |
598 if ( !subConnUpDownNotifier->IsActive() ) |
599 if ( !subConnUpDownNotifier->IsActive() ) |
599 { |
600 { |
600 subConnUpDownNotifier->Receive(); |
601 subConnUpDownNotifier->Receive(); |
|
602 subConnUpDownNotifier->SetLinkLayerOpen(); |
601 } |
603 } |
602 } |
604 } |
603 |
605 |
604 // Start activity notifier when stage reaches KLinkLayerOpen |
606 // Start activity notifier when stage reaches KLinkLayerOpen |
605 TRAPD( ret, ( iServer->Iap()->LaunchActivityNotifierL( iConnectionId ) ) ); |
607 TRAPD( ret, ( iServer->Iap()->LaunchActivityNotifierL( iConnectionId ) ) ); |
629 |
631 |
630 if ( ret == KErrNone && bearerInfo.iBearer == EBearerInfoWLAN ) |
632 if ( ret == KErrNone && bearerInfo.iBearer == EBearerInfoWLAN ) |
631 { |
633 { |
632 LOGIT("CProgressNotifier::RunL triggered HandleAvailabilityChange()") |
634 LOGIT("CProgressNotifier::RunL triggered HandleAvailabilityChange()") |
633 iServer->AvailabilityManager()->HandleAvailabilityChange(); |
635 iServer->AvailabilityManager()->HandleAvailabilityChange(); |
634 } |
636 } |
|
637 |
|
638 } |
|
639 else if ( iInfoBuf().iStage == KLinkLayerClosed ) |
|
640 { |
|
641 CSubConnUpDownNotifier* subConnUpDownNotifier = 0; |
|
642 |
|
643 TInt err = iServer->Iap()->GetSubConnUpDownNotifier( |
|
644 iConnectionId, |
|
645 &subConnUpDownNotifier ); |
|
646 |
|
647 if ( KErrNone == err ) |
|
648 { |
|
649 subConnUpDownNotifier->SetLinkLayerClosed(); |
|
650 |
|
651 if ( subConnUpDownNotifier->InterfaceClosed() ) |
|
652 { |
|
653 // EInterfaceDown has arrived before KLinkLayerClosed |
|
654 // Let's finish with this connection. |
|
655 subConnUpDownNotifier->SendDeletedEvent(); |
|
656 return; |
|
657 } |
|
658 } |
635 } |
659 } |
636 |
660 |
637 iFilter = KNoFiltering; |
661 iFilter = KNoFiltering; |
638 } |
662 } |
639 else |
663 else |
2174 void CSubConnUpDownNotifier::SetInterfaceClosed() |
2200 void CSubConnUpDownNotifier::SetInterfaceClosed() |
2175 { |
2201 { |
2176 iInterfaceClosed = ETrue; |
2202 iInterfaceClosed = ETrue; |
2177 } |
2203 } |
2178 |
2204 |
|
2205 // ----------------------------------------------------------------------------- |
|
2206 // CSubConnUpDownNotifier::InterfaceClosed |
|
2207 // ----------------------------------------------------------------------------- |
|
2208 // |
|
2209 TBool CSubConnUpDownNotifier::InterfaceClosed() |
|
2210 { |
|
2211 return iInterfaceClosed; |
|
2212 } |
|
2213 |
|
2214 // ----------------------------------------------------------------------------- |
|
2215 // CSubConnUpDownNotifier::SetLinkLayerClosed |
|
2216 // ----------------------------------------------------------------------------- |
|
2217 // |
|
2218 void CSubConnUpDownNotifier::SetLinkLayerClosed() |
|
2219 { |
|
2220 iLinkLayerClosed = ETrue; |
|
2221 } |
|
2222 |
|
2223 // ----------------------------------------------------------------------------- |
|
2224 // CSubConnUpDownNotifier::SetLinkLayerOpen |
|
2225 // ----------------------------------------------------------------------------- |
|
2226 // |
|
2227 void CSubConnUpDownNotifier::SetLinkLayerOpen() |
|
2228 { |
|
2229 iLinkLayerClosed = EFalse; |
|
2230 } |
|
2231 |
|
2232 // ----------------------------------------------------------------------------- |
|
2233 // CSubConnUpDownNotifier::LinkLayerClosed |
|
2234 // ----------------------------------------------------------------------------- |
|
2235 // |
|
2236 TBool CSubConnUpDownNotifier::LinkLayerClosed() |
|
2237 { |
|
2238 return iLinkLayerClosed; |
|
2239 } |
2179 |
2240 |
2180 // ----------------------------------------------------------------------------- |
2241 // ----------------------------------------------------------------------------- |
2181 // CSubConnUpDownNotifier::DoCancel |
2242 // CSubConnUpDownNotifier::DoCancel |
2182 // Cancels the request from RConnection. |
2243 // Cancels the request from RConnection. |
2183 // ----------------------------------------------------------------------------- |
2244 // ----------------------------------------------------------------------------- |
2238 iTotalUplinkDataVolume = closedEvent.iTotalUplinkDataVolume; |
2302 iTotalUplinkDataVolume = closedEvent.iTotalUplinkDataVolume; |
2239 |
2303 |
2240 LOGIT3("SERVER: EVENT -> Connection %d closed, u: %d, d: %d", |
2304 LOGIT3("SERVER: EVENT -> Connection %d closed, u: %d, d: %d", |
2241 iConnectionId, iTotalUplinkDataVolume, iTotalDownlinkDataVolume) |
2305 iConnectionId, iTotalUplinkDataVolume, iTotalDownlinkDataVolume) |
2242 |
2306 |
|
2307 iStatus = KErrDisconnected; |
|
2308 |
2243 CProgressNotifier* progressNotifier = 0; |
2309 CProgressNotifier* progressNotifier = 0; |
2244 TInt err = iServer->Iap()->GetProgressNotifier( iConnectionId, &progressNotifier ); |
2310 TInt err = iServer->Iap()->GetProgressNotifier( iConnectionId, &progressNotifier ); |
2245 if ( err == KErrNone ) |
2311 if ( err == KErrNone ) |
2246 { |
2312 { |
2247 // Progess notifier has stopped and allinterface closed event has arrived |
2313 // Progess notifier has stopped and allinterface closed event has arrived |
2248 if ( !progressNotifier->IsActive() ) |
2314 if ( !progressNotifier->IsActive() ) |
2249 { |
2315 { |
|
2316 // might delete this object |
2250 SendDeletedEvent(); |
2317 SendDeletedEvent(); |
|
2318 return; |
2251 } |
2319 } |
2252 } |
2320 } |
2253 else |
2321 else |
2254 { |
2322 { |
|
2323 // might delete this object |
2255 SendDeletedEvent(); |
2324 SendDeletedEvent(); |
2256 } |
2325 return; |
2257 |
2326 } |
2258 iStatus = KErrDisconnected; |
|
2259 } |
2327 } |
2260 else if ( ( event.iSubConnectionUniqueId == 0 ) && |
2328 else if ( ( event.iSubConnectionUniqueId == 0 ) && |
2261 ( event.iEventType == ESubConnectionOpened ) ) |
2329 ( event.iEventType == ESubConnectionOpened ) ) |
2262 { |
2330 { |
2263 // IS THIS A RECONNECT |
2331 // IS THIS A RECONNECT |