Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/file protection #1522

Merged
merged 3 commits into from
Dec 19, 2016
Merged

Fix/file protection #1522

merged 3 commits into from
Dec 19, 2016

Conversation

snej
Copy link
Contributor

@snej snej commented Nov 29, 2016

Better support for iOS file protection and backgrounding:

  • Enabled file protection in the iOS test app (note: only takes effect on a real device; simulator does not implement file protection!)
  • The test app logs when app state changes in various ways, like going into/out of the background or files becoming inaccessible.
  • Made MYBackgroundMonitor work better if the app is already backgrounded and if the background task expires. (See MYUtilities commit)
  • Added CBLDatabase.fileProtection property
  • REST replicator monitors when files become inaccessible and suspends the replicator for the duration.
  • Thread-safety improvements in CBLRestReplicator+Backgrounding: make sure UIApplication is only called on the main thread.
  • Defined new internal status kCBLStatusFilesystemLocked for when we know that file I/O failed due to file protection. It gets reported as a 500 status with message “Device locked”.

Replicator should save checkpoint before going idle

Otherwise it doesn’t save the checkpoint if it’s finishing a replication in a background task (the process will be suspended before the timer goes off.)

Replicator: Fixed some logic in -reachabilityChanged handling _suspended

When _suspended is true it should always call goOffline regardless of trustReachability.

@snej snej added this to the 1.4.0 milestone Nov 29, 2016
@snej snej added the review label Nov 29, 2016
Copy link
Contributor

@pasin pasin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me. Can you fix the conflicts ? Also the link to MYUtilities is broken.

@snej snej assigned snej and unassigned pasin Dec 16, 2016
@snej snej added ready and removed review labels Dec 16, 2016
@snej
Copy link
Contributor Author

snej commented Dec 16, 2016

Related to #1461 (background monitor); #1443 #1422 #1405 (file protection).

snej added 3 commits December 16, 2016 15:56
* Enabled file protection in the iOS test app (note: only takes effect
  on a real device; simulator does not implement file protection!)
* The test app logs when app state changes in various ways, like going
  into/out of the background or files becoming inaccessible.
* Made MYBackgroundMonitor work better if the app is already backgrounded
  and if the background task expires. (See MYUtilities commit)
* Added CBLDatabase.fileProtection property
* REST replicator monitors when files become inaccessible and suspends
  the replicator for the duration.
* Thread-safety improvements in CBLRestReplicator+Backgrounding: make
  sure UIApplication is only called on the main thread.
* Defined new internal status kCBLStatusFilesystemLocked for when we
  know that file I/O failed due to file protection. It gets reported
  as a 500 status with message “Device locked”.

Should fix #1461 (background monitor); #1443 #1422 #1405 (file protection).
Otherwise it doesn’t save the checkpoint if it’s finishing a replication
in a background task (the process will be suspended before the timer
goes off.)
When _suspended is true it should always call goOffline regardless of
trustReachability.
@snej snej force-pushed the fix/file_protection branch from 9eebca1 to 9303880 Compare December 16, 2016 23:57
@snej
Copy link
Contributor Author

snej commented Dec 16, 2016

Rebased, added some issue links in the commits, pushed the latest MYUtilities. Ready for you, @pasin.

@snej snej assigned pasin and unassigned snej Dec 16, 2016
@pasin
Copy link
Contributor

pasin commented Dec 17, 2016

@snej MYUtilities link is still not valid.

@pasin pasin merged commit 7259d79 into master Dec 19, 2016
@pasin pasin deleted the fix/file_protection branch December 19, 2016 20:50
@pasin pasin removed the ready label Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants