Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename getMetadata to prepareMetadata and ensure data access protected
Currently the setChanged flag is being cleared/set while the data mutex is not locked. As getMessage() already aquires this lock and is only ever used when sending a message, move the flag clear inside this method and rename to prepareMetadata to reflect the fact it is no longer simply retrieving data. Add a lock within the error callback in case sending fails and the flag must be reset This looks scary as we have multiple locks being aquired within sendMetadata() I think it's ok as on the send side we are already aquiring this lock, we're just adding a data mutation. On the receive side we're adding a lock, but we will only ever call the success or failure path, never both, so shouldn't be the case where we might deadlock waiting for two different mutexes - in this way it's no different to aquiring a lock in any of the setter methods.
- Loading branch information