Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MXCrypto: Move decryptions out of the main thread #1091

Merged
merged 35 commits into from
May 20, 2021

Commits on May 19, 2021

  1. MXEventDecryptionResult: Add an error property

    and make it the single object returned after a decryption
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    c1fd75c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    75f5aa8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0cd77a9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    38df17f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    e3b6c91 View commit details
    Browse the repository at this point in the history
  6. MXCrypto: Change signature of decryptEvents(): Not all events have ev…

    …ent id
    
    ex: to_device events
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    3938d43 View commit details
    Browse the repository at this point in the history
  7. MXSession: decryptEvents: Decrypt only encrypted events

    and ignore others. Do not consider them as errors
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    f5e09cd View commit details
    Browse the repository at this point in the history
  8. MXSession: handleSyncResponse: Decrypt asynchronously to_device events

    MXCrypto.handleRoomKeyEvent() has been added to know exactly when we can start decrypting.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    8c2479a View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    44ec72d View commit details
    Browse the repository at this point in the history
  10. MXEvent: editedEventFromReplacementEvent: Use decrypted replacing eve…

    …nt data
    
    It solves 2 things:
     - avoid synchronous decryption
     - decryption of the  MXRoomSummary.lastMessageEvent when it is edited (element-hq/element-ios/issues/4322)
    
    Plus it saves a decryption.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    fbde49c View commit details
    Browse the repository at this point in the history
  11. MXEvent: eventWithNewReferenceRelation: Reuse already decrypted data

    to avoid useless (synchronous) decryption like in the previous commit
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    7668262 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    142554c View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    3ddfacb View commit details
    Browse the repository at this point in the history
  14. MXSession: eventWithEventId: Decrypt the event if needed.

    This will save synchronous decryption
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    7540bd5 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e6d5f2d View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    3ef3d87 View commit details
    Browse the repository at this point in the history
  17. MXRoomSummary: Reimplement fetchLastMessage

    to avoid any synchronous decryption.
    
    The algo is probably simpler.
    
    It also fixes testGetLastMessageFromPagination, testGetLastMessageFromSeveralPaginations and testFixRoomsSummariesLastMessage tests that have been broken since b4d5ba7
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    b0352f2 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    ba2f1b5 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    f9e5d9d View commit details
    Browse the repository at this point in the history
  20. MXRoomSummary: Do not decrypt synchronously lastMessageEvent anymore

    lastMessageEvent is required by room list. It took 1.3 seconds on the main thread to get it on my account (600 rooms). Now there are asynchronously preloaded and decrypted when the SDK load.
    
    One test has been fixed. As events are now decrypted only upstream and no more on demand, we need to trigger a decrypt to mimic this upstream decryption.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    ee740cd View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    15b0f71 View commit details
    Browse the repository at this point in the history
  22. oops

    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    2a87567 View commit details
    Browse the repository at this point in the history
  23. MXCrypto: Make sure we get algorithm from the wire JSON content

    as it is not available in the decrypted JSON content
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    949389a View commit details
    Browse the repository at this point in the history
  24. MXRoomSummary: Implement fetchLastMessage in another way

    that does not pollute existing listeners on the live timeline
    
    There can be only one component that paginates message from a time else there is will be races.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    e6e7b2c View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    4534cff View commit details
    Browse the repository at this point in the history
  26. MXRoom: MXRoom.outgoingMessages does not decrypt messages anymore

    Use MXSession.decryptEvents to get decrypted events.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    000e144 View commit details
    Browse the repository at this point in the history
  27. MXCrypto: Deprecate [MXSession decryptEvent:inTimeline:] and [MXCrypt…

    …o decryptEvent:inTimeline:]
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    2275162 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    fa92f6b View commit details
    Browse the repository at this point in the history
  29. MXCrypto: eventDeviceInfo: Do not synchronise the operation anymore w…

    …ith the decryption queue.
    
    A single decryption takes 5ms on an iPhoneX. It was useless to synchronise this method with the busy decryption thread. There is no relationship.
    
    Note that this operation uses 0.5ms. It must not be called from the main thread.
    MatrixKit uses this method to build the timeline. It uses on a dedicated queue.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    7c23242 View commit details
    Browse the repository at this point in the history
  30. MXEventTimeline: Fix regression on paginate:

    We must not call complete() before returning.
    It breaks pagination in MatrixKit that uses the returned MXHTTPOperation.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    aa775ff View commit details
    Browse the repository at this point in the history
  31. MXCrossSigning: Fix a race condition in refreshStateWithSuccess

    This method is called from the main thread. It should not use directly elf.crypto.deviceList that is managed by the cryptoQueue.
    manuroe committed May 19, 2021
    Configuration menu
    Copy the full SHA
    873158b View commit details
    Browse the repository at this point in the history

Commits on May 20, 2021

  1. Update MatrixSDK/Data/MXEventTimeline.m

    Co-authored-by: SBiOSoftWhare <SBiOSoftWhare@users.noreply.github.com>
    manuroe and SBiOSoftWhare committed May 20, 2021
    Configuration menu
    Copy the full SHA
    af236fe View commit details
    Browse the repository at this point in the history
  2. Update MatrixSDK/Data/MXEventTimeline.m

    Co-authored-by: SBiOSoftWhare <SBiOSoftWhare@users.noreply.github.com>
    manuroe and SBiOSoftWhare committed May 20, 2021
    Configuration menu
    Copy the full SHA
    b95906a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6e58796 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #1095 from matrix-org/manu/async_decryption2

    End of the removal of decryption on the main thread
    manuroe committed May 20, 2021
    Configuration menu
    Copy the full SHA
    d8ed7e2 View commit details
    Browse the repository at this point in the history