ExternalEncryption: Sync at the very end of the operation 12/148712/2
authorLukasz Pawelczyk <l.pawelczyk@samsung.com>
Fri, 8 Sep 2017 10:18:05 +0000 (12:18 +0200)
committerLukasz Pawelczyk <l.pawelczyk@samsung.com>
Mon, 11 Sep 2017 11:26:20 +0000 (13:26 +0200)
Change-Id: Iec7639130371d1bd2e393e8a71bf11cd4eabd190

server/external-encryption.cpp

index 65373a2..0690f2c 100644 (file)
@@ -310,11 +310,11 @@ int ExternalEncryption::encrypt(const std::string &password, unsigned int option
                        INFO(SINK, "Encryption started...");
                        engine->encrypt(MasterKey, options);
                        setOptions(options & getSupportedOptions());
-                       INFO(SINK, "Sync disk...");
-                       sync();
                        INFO(SINK, "Encryption completed");
                        ::vconf_set_str(EXTERNAL_STATE_VCONF_KEY, "encrypted");
                        context.notify("ExternalEncryption::mount");
+                       INFO(SINK, "Sync disk...");
+                       sync();
                } catch (runtime::Exception &e) {
                        ::vconf_set_str(EXTERNAL_STATE_VCONF_KEY, "error_partially_encrypted");
                        ERROR(SINK, "Encryption failed - " + std::string(e.what()));
@@ -358,10 +358,10 @@ int ExternalEncryption::decrypt(const std::string &password)
                        INFO(SINK, "Decryption started...");
                        ::vconf_set_str(EXTERNAL_STATE_VCONF_KEY, "error_partially_encrypted");
                        engine->decrypt(MasterKey, getOptions());
-                       INFO(SINK, "Sync disk...");
-                       sync();
                        INFO(SINK, "Decryption completed");
                        ::vconf_set_str(EXTERNAL_STATE_VCONF_KEY, "unencrypted");
+                       INFO(SINK, "Sync disk...");
+                       sync();
                } catch (runtime::Exception &e) {
                        ERROR(SINK, "Decryption failed - " + std::string(e.what()));
                }