Skip to content

Commit

Permalink
Fix possible race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
inetic committed Jun 18, 2024
1 parent 5814638 commit 26323cd
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ public class OuisyncSession {
}

fileprivate func generateMessageId() -> MessageId {
let messageId = nextMessageId
nextMessageId += 1
return messageId
synchronized(self) {
let messageId = nextMessageId
nextMessageId += 1
return messageId
}
}

fileprivate func sendDataToOuisyncLib(_ data: [UInt8]) {
Expand Down

0 comments on commit 26323cd

Please sign in to comment.