add more logging while loading database to get more info regarding #2868
This commit is contained in:
@@ -83,6 +83,7 @@ namespace KeePassLib.Serialization
|
||||
if (m_bUsedOnce)
|
||||
throw new InvalidOperationException("Do not reuse KdbxFile objects!");
|
||||
m_bUsedOnce = true;
|
||||
Kp2aLog.Log("Starting to load KDBX file...");
|
||||
|
||||
#if KDBX_BENCHMARK
|
||||
Stopwatch swTime = Stopwatch.StartNew();
|
||||
@@ -257,6 +258,7 @@ namespace KeePassLib.Serialization
|
||||
MessageService.ShowInfo("Loading KDBX took " +
|
||||
swTime.ElapsedMilliseconds.ToString() + " ms.");
|
||||
#endif
|
||||
Kp2aLog.Log("Finished loading KDBX file.");
|
||||
}
|
||||
|
||||
private void CommonCleanUpRead(List<Stream> lStreams, HashingStreamEx sHashing)
|
||||
|
||||
@@ -90,8 +90,11 @@ namespace keepass2android
|
||||
PwDatabase pwDatabase = new PwDatabase();
|
||||
|
||||
IFileStorage fileStorage = _app.GetFileStorage(iocInfo);
|
||||
Kp2aLog.Log("LoadData: Retrieving stream");
|
||||
Stream s = databaseData ?? fileStorage.OpenFileForRead(iocInfo);
|
||||
Kp2aLog.Log("LoadData: GetCurrentFileVersion");
|
||||
var fileVersion = _app.GetFileStorage(iocInfo).GetCurrentFileVersionFast(iocInfo);
|
||||
Kp2aLog.Log("LoadData: PopulateDatabaseFromStream");
|
||||
PopulateDatabaseFromStream(pwDatabase, s, iocInfo, compositeKey, status, databaseFormat);
|
||||
LastFileVersion = fileVersion;
|
||||
|
||||
|
||||
@@ -138,6 +138,7 @@ namespace keepass2android
|
||||
|
||||
Database TryLoad(MemoryStream databaseStream)
|
||||
{
|
||||
Kp2aLog.Log("LoadDb: Copying database in memory");
|
||||
//create a copy of the stream so we can try again if we get an exception which indicates we should change parameters
|
||||
//This is not optimal in terms of (short-time) memory usage but is hard to avoid because the Keepass library closes streams also in case of errors.
|
||||
//Alternatives would involve increased traffic (if file is on remote) and slower loading times, so this seems to be the best choice.
|
||||
@@ -146,6 +147,7 @@ namespace keepass2android
|
||||
workingCopy.Seek(0, SeekOrigin.Begin);
|
||||
//reset stream if we need to reuse it later:
|
||||
databaseStream.Seek(0, SeekOrigin.Begin);
|
||||
Kp2aLog.Log("LoadDb: Ready to start loading");
|
||||
//now let's go:
|
||||
try
|
||||
{
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace keepass2android
|
||||
var prefs = PreferenceManager.GetDefaultSharedPreferences(LocaleManager.LocalizedAppContext);
|
||||
var createBackup = prefs.GetBoolean(LocaleManager.LocalizedAppContext.GetString(Resource.String.CreateBackups_key), true)
|
||||
&& !(new LocalFileStorage(this).IsLocalBackup(ioConnectionInfo));
|
||||
|
||||
Kp2aLog.Log("LoadDb: Copying database for backup");
|
||||
MemoryStream backupCopy = new MemoryStream();
|
||||
if (createBackup)
|
||||
{
|
||||
@@ -201,6 +201,7 @@ namespace keepass2android
|
||||
//reset stream if we need to reuse it later:
|
||||
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||
}
|
||||
Kp2aLog.Log("LoadDb: Checking open databases");
|
||||
|
||||
foreach (Database openDb in _openDatabases)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user