3.1.4.3.2 Exit Coauthoring Session
If the CoauthRequestType attribute is set to "ExitCoauthoring", the protocol server considers this coauthoring subrequest to be of type, "Exit coauthoring session". The protocol server processes the request to exit the coauthoring session and checks the number of clients editing the document at that instant in time. When the protocol server receives a coauthoring subrequest of type "Exit coauthoring session" from the last and only client editing the document, the protocol server does both of the following:
Delete the client identifier entry associated with the client in the file coauthoring tracker. The file coauthoring tracker is defined in section 3.1.1.
Delete the coauthoring session and the shared lock on the file if the client that sent the subrequest of type "Exit coauthoring session" is the last client in the file coauthoring tracker.
If the current client is not already present in the coauthoring session, the protocol server does one of the following:
Return an error code of "Success"<44>, if there are other clients present in the coauthoring session.
Return an error code of "FileNotLockedOnServer" if no clients are present in the coauthoring session.
The protocol server SHOULD<45> return an error code of "FileAlreadyLockedOnServer" if there is a current exclusive lock on the file or a shared lock on the file with a different schema lock identifier.
If the coauthoring session has already been deleted, the protocol server returns an error code value set to "Success", as specified in section 2.2.5.6.
If any failure occurs such that the subrequest cannot be processed successfully, the protocol server returns an error. The error that the protocol server returns is implementation-specific. Errors that are directly returned by the protocol server are implementation-specific. LockAndCoauthRelatedErrorCodeTypes is defined in section 2.2.5.8, and generic error code types are defined in section 2.2.5.6. For other unknown error types, the protocol server returns an error code value set to "LockRequestFail".