# Safety Mechanism ## Locking mechanism To avoid mismatched synchronisation, when Self-hosted LiveSync initialises the local database, a device ID (consisting of random characters) is created and stored in that. And, Self-hosted LiveSync is able to connect only to the remote database which has the device ID. #status/work_in_progress ```mermaid sequenceDiagram autonumber actor d1 as Device 1 participant db as PouchDB actor d2 as Device 2 d1->>db: First sync activate db Note left of db: [d1] d2-->>db: Device 2 will not accept the server. d2->>db: Fetch: add device ID <br> (This means you accepted the remote) Note left of db: [d1,d2] d1->>db: Device 1 still accept the server. d2->>db: Lock: overwrite device ID <br> (This means you want to reject others) Note left of db: [d2] d1-->>db: Now, Device 1 will not accept the server. deactivate db ``` # Lock the database No. 5 of the figure. #status/work_in_progress ## Document information - Written as of: - Self-hosted LiveSync version 0.17.34 - Valid up to: - Self-hosted LiveSync version 0.18.00 - 1st March 2023