236 void CAbstractMediaMtpDataProvider::SessionClosedL( const TMTPNotificationParamsSessionChange& aSession ) |
236 void CAbstractMediaMtpDataProvider::SessionClosedL( const TMTPNotificationParamsSessionChange& aSession ) |
237 { |
237 { |
238 iIsSessionOpen = EFalse; |
238 iIsSessionOpen = EFalse; |
239 TInt count = iActiveProcessors.Count(); |
239 TInt count = iActiveProcessors.Count(); |
240 PRINT1( _L( "MM MTP => CAbstractMediaMtpDataProvider::SessionClosedL, total processor count = %d" ), count ); |
240 PRINT1( _L( "MM MTP => CAbstractMediaMtpDataProvider::SessionClosedL, total processor count = %d" ), count ); |
241 for ( TInt i = 0; i < count; i++ ) |
241 while ( count-- ) |
242 { |
242 { |
243 MMmRequestProcessor* processor = iActiveProcessors[i]; |
243 MMmRequestProcessor* processor = iActiveProcessors[count]; |
244 |
244 |
245 // replaced for the Request() is invalid sometimes |
|
246 // TUint32 sessionId( processor->Request().Uint32( TMTPTypeRequest::ERequestSessionID ) ); |
|
247 TUint32 sessionId = processor->SessionId(); |
245 TUint32 sessionId = processor->SessionId(); |
248 |
246 |
249 if ( ( sessionId == aSession.iMTPId ) |
247 if ( ( sessionId == aSession.iMTPId ) |
250 && ( processor->Connection().ConnectionId() |
248 && ( processor->Connection().ConnectionId() |
251 == aSession.iConnection.ConnectionId() ) ) |
249 == aSession.iConnection.ConnectionId() ) ) |
252 { |
250 { |
253 processor->UsbDisconnect(); // Rollback |
251 processor->UsbDisconnect(); // Rollback |
254 |
252 |
255 iActiveProcessors.Remove( i ); |
253 iActiveProcessors.Remove( count ); |
256 if ( i == iActiveProcessor ) |
254 if ( count == iActiveProcessor ) |
257 { |
255 { |
258 iActiveProcessorRemoved = ETrue; |
256 iActiveProcessorRemoved = ETrue; |
|
257 iActiveProcessor = -1; // update iActiveProcessor |
259 } |
258 } |
260 else |
259 else |
261 { |
260 { |
262 processor->Release(); |
261 processor->Release(); |
263 } |
262 } |