Skip to content

Commit

Permalink
fix: map and ignore BufferedFutureMessage (#2084)
Browse files Browse the repository at this point in the history
  • Loading branch information
typfel committed Oct 4, 2023
1 parent 7408242 commit 932bc15
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ actual fun mapMLSException(exception: Exception): MLSFailure =
when (exception.error) {
is CryptoError.WrongEpoch -> MLSFailure.WrongEpoch
is CryptoError.DuplicateMessage -> MLSFailure.DuplicateMessage
is CryptoError.BufferedFutureMessage -> MLSFailure.BufferedFutureMessage
is CryptoError.SelfCommitIgnored -> MLSFailure.SelfCommitIgnored
is CryptoError.UnmergedPendingGroup -> MLSFailure.UnmergedPendingGroup
is CryptoError.ConversationAlreadyExists -> MLSFailure.ConversationAlreadyExists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ interface MLSFailure : CoreFailure {

object DuplicateMessage : MLSFailure

object BufferedFutureMessage : MLSFailure

object SelfCommitIgnored : MLSFailure

object UnmergedPendingGroup : MLSFailure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ sealed class MLSMessageFailureResolution {
internal object MLSMessageFailureHandler {
fun handleFailure(failure: CoreFailure): MLSMessageFailureResolution {
return when (failure) {
// Received messages targeting a future epoch, we might have lost messages.
// Received messages targeting a future epoch (outside epoch bounds), we might have lost messages.
is MLSFailure.WrongEpoch -> MLSMessageFailureResolution.OutOfSync
// Received already sent or received message, can safely be ignored.
is MLSFailure.DuplicateMessage -> MLSMessageFailureResolution.Ignore
// Received self commit, any unmerged group has know when merged by CoreCrypto.
// Received message was targeting a future epoch and been buffered, can safely be ignored.
is MLSFailure.BufferedFutureMessage -> MLSMessageFailureResolution.Ignore
// Received self commit, any unmerged group has know been when merged by CoreCrypto.
is MLSFailure.SelfCommitIgnored -> MLSMessageFailureResolution.Ignore
// Message arrive in an unmerged group, it has been buffered and will be consumed later.
is MLSFailure.UnmergedPendingGroup -> MLSMessageFailureResolution.Ignore
Expand Down

0 comments on commit 932bc15

Please sign in to comment.