Fix #30 - Add protection against permanent sync locking

A client used to be able to hold the server hostage, preventing other clients from doing an upstream sync, if they disconnected during their sync. This fixes that problem.
Update unit tests for sync locking.