# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277124251 -10800 # Node ID 75a6055b8ce34a1182d183898719e79c4f4a5059 # Parent 3634639e6dc7d100668027775b2a18f65f98bab5 Revision: 201023 Kit: 2010125 diff -r 3634639e6dc7 -r 75a6055b8ce3 wlansecuritysettings/wepsecuritysettingsui/src/WEPSecuritySettingsImpl.cpp --- a/wlansecuritysettings/wepsecuritysettingsui/src/WEPSecuritySettingsImpl.cpp Tue May 11 16:16:37 2010 +0300 +++ b/wlansecuritysettings/wepsecuritysettingsui/src/WEPSecuritySettingsImpl.cpp Mon Jun 21 15:44:11 2010 +0300 @@ -16,7 +16,7 @@ */ /* -* %version: tr1cfwln#26 % +* %version: tr1cfwln#27 % */ // INCLUDE FILES @@ -534,6 +534,9 @@ void CWEPSecuritySettingsImpl::SaveL( TUint32 aIapId, CMDBSession& aSession ) const { + const TInt KRetryWait = 100000; // Wait time between retries in TTimeIntervalMicroSeconds32 + const TInt KRetryCount = 50; // Max retry count + // Load WLAN service table // first get WLAN table id CMDBGenericRecord* generic = static_cast @@ -588,17 +591,41 @@ ( generic->GetFieldByIdL( KCDTIdWlanFormatKey4 ) ); formatKey4Field->SetL( iKeyFormat[ KFourthKey ] ); - // If table existed modify it - if( found ) + TInt error( KErrNone ); + + // Saving changes + for ( TInt i( 0 ); i < KRetryCount; i++ ) { - generic->ModifyL( aSession ); + + // If table existed modify it + if( found ) + { + TRAP( error, generic->ModifyL( aSession ) ); + } + + // Otherwise store a new record + else + { + generic->SetRecordId( KCDNewRecordRequest ); + TRAP( error, generic->StoreL( aSession ) ); + } + + // If operation failed with KErrLocked, we'll retry. + if ( KErrLocked == error ) + { + User::After( KRetryWait ); + } + + // Otherwise break the retry loop. + else + { + break; + } } - // Otherwise store a new record - else - { - generic->SetRecordId( KCDNewRecordRequest ); - generic->StoreL( aSession ); - } + + // If the save operation failed, leave now. + User::LeaveIfError( error ); + CleanupStack::PopAndDestroy( generic ); }