Commit Graph

31 Commits

Author SHA1 Message Date
Harry
8f8e74e2b5
Update message processor suspension-related behavior
* use set of enums for message suspensions

* Update meaning of isDrainingPendingEnvelopes

* rename messageProcessorDidFlushQueue -> ...DidDrainQueue
2023-03-16 14:23:10 -07:00
Sasha Weiss
82fad84831
Initial implementation of PNI change-number 2023-03-09 17:13:16 -08:00
Evan Hahn
370ff654e7
Change license to AGPL
Change license to AGPL

This commit:

- Updates the `LICENSE` file

- Start every file with something like:

      // Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
      // SPDX-License-Identifier: AGPL-3.0-only

---

First, I removed existing license headers with this Ruby 3.1.2 script:

    require 'set'

    EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']

    same = 0
    different = 0

    all_files = `git ls-files`.lines.map { |line| line.strip }
    all_files.each do |relative_path|
      if relative_path == 'Pods'
        next
      end

      unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
        next
      end

      path = File.expand_path(relative_path)

      contents = File.read(path)
      new_contents = contents.sub(/\/\/\n\/\/  Copyright .*\n\/\/\n\n/, '')

      if contents == new_contents
        same += 1
      else
        different += 1
      end

      File.write(path, new_contents)
    end

    puts "updated #{different} file(s), left #{same} untouched"

I'm sure this script could be improved, but it worked well enough.

Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.

Then I fixed some stragglers and updated the precommit script.

See [a similar change in the Desktop app][0].

[0]: 8bfaf598af
2022-10-13 08:25:37 -05:00
Jordan Rose
7ba2a8ee2d Avoid deserializing envelope data more than necessary
Our envelopes go through a lot of transformations during processing:
0. If using REST, JSON delivered by the server is converted to
   SSKProtoEnvelope (MessageFetcherJob.buildEnvelope(messageDict:))
1a. If using REST, envelopes are serialized and enqueued for individual
    jobs (MessageFetcherJob.fetchMessagesViaRest())
1b. If using the web socket, the message is deserialized from protobuf
    (MessageProcessor.processEncryptedEnvelopeData(...))
2. If the envelope uses sealed sender, the sender is written into
   a new proto and reserialized
   (OWSMessageDecryptor.decryptUnidentifiedSenderEnvelope(...))
3. The serialized envelope is deserialized *again* for preprocessing,
   GV2 discard mode checking, and (potentially) actual processing.
   (MessageProcessor.processEnvelope(_:transaction:))
4. If the envelope is delayed, it'll be deserialized when it's finally
   processed
   (IncomingGroupsV2MessageJob.envelope)

This commit improves the situation by
- skipping the serialization in step #1a
- skipping the serialization in step #2
- reusing the SSKProtoEnvelope from decryption in message processing,
  avoiding the deserialization in step #3
- potentially serializing in step #4 if there's no up-to-date
  serialized data (either because the envelope was modified, or
  because it came from REST and we never had it in the first place)

Note that IncomingGroupsV2MessageJob is persisted across transactions
in the database, so it needs the envelope to be serialized.
2022-04-11 15:55:39 -07:00
Jordan Rose
49d4684013 Teach OWSIdentityManager about PNI identity keys
And make all callers explicitly say which one they want (which for now
is always the ACI identity key).
2022-03-16 13:29:20 -07:00
Matthew Chen
9271f83624 Remove databaseChangesWillUpdate. 2021-09-08 21:41:13 -03:00
Matthew Chen
fcdca12cf5 Deprecate REST, Part 1
* Port socket manager to Swift.
* Clean up HTTP request success/failure state & errors.
* Rework network manager.
* Rework HTTP errors.
* Rework errors "properties": isRetryable, etc.
* Fix test breakage.
2021-08-18 14:25:36 -03:00
Matthew Chen
f2b76e60f9 Refine names. 2021-07-02 22:08:53 -03:00
Matthew Chen
8b73e93be2 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
f06b72bc2a Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
75de56236b Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
4e23a9349d Respond to CR. 2021-07-01 15:53:59 -07:00
Matthew Chen
6613f8562e Respond to CR. 2021-07-01 15:53:59 -07:00
Matthew Chen
61f8d68231 Respond to CR. 2021-03-25 14:43:08 -03:00
Matthew Chen
86b8eb08b8 Remove YapDatabase.
Apply asset from design.

Fix rebase breakage.
2021-03-25 11:41:16 -03:00
Matthew Chen
d0cbf8cfd0 Rework dependency access. 2021-03-25 09:24:27 -03:00
Nora Trapp
5f8f048202 Fix tests 2021-02-23 10:45:50 -08:00
Nora Trapp
91d2953843 Begone OWSMessageReceiver 2021-02-23 10:45:50 -08:00
Nora Trapp
3991802fa8 Add appropriate restrictions to when message processing can run. 2021-02-23 10:45:50 -08:00
Nora Trapp
16708b9dd7 Batch message decryption and processing 2021-02-23 10:45:50 -08:00
Nora Trapp
ad6583facb Eliminate usage of decrypt job queue 2021-02-23 10:45:50 -08:00
Nora Trapp
ad19838ee2 Fix message processing perf tests 2021-02-10 17:13:21 -08:00
Jordan Rose
07c20a5f6f Rename the SignalClient test protocol to avoid conflicts 2021-01-28 12:03:50 -08:00
Matthew Chen
13e7456d22 Fix some of the performance tests. 2020-10-16 10:15:16 -03:00
Matthew Chen
3cedd3ccdf Overhaul database observation. 2020-06-18 09:28:49 -03:00
Matthew Chen
e46eefe50e Remove readReturningResult(). 2019-11-14 10:39:33 -03:00
Michael Kirk
329fffb8e2 Fixing up phonenumber parsing tests 2019-10-25 18:33:56 -07:00
Michael Kirk
2483f75e4d more efficient uidb updates, fix checkpointing 2019-09-23 16:04:41 -07:00
Michael Kirk
6eb1595e87 update GRDB 2019-09-04 18:23:01 -06:00
Michael Kirk
377632f7eb Sending perf test - baseline 2019-09-04 18:21:40 -06:00
Michael Kirk
843339a150 perf test for message processing 2019-09-04 18:21:40 -06:00