Commit Graph

449 Commits

Author SHA1 Message Date
Michelle Linington
a74f22cfca Fix compilation issue in tests 2021-10-28 12:40:56 -07:00
Michelle Linington
65601d227e Fixes a couple of sender key issues:
- Failed sender key sends weren't properly retrying
- Spurious asserts when a delivery receipt for a sent message arrives
  before we finish the send
2021-10-28 12:40:56 -07:00
Matthew Chen
42c3028381 Don't cache contacts on contacts manager. 2021-10-22 19:09:45 -03:00
Matthew Chen
c494fb2a44 Don't cache contacts on contacts manager. 2021-10-22 19:09:44 -03:00
Matthew Chen
2d8dc4036c Add PhoneNumberUtilTestSwift. 2021-10-22 19:06:48 -03:00
Matthew Chen
007a00a17b Add PhoneNumberUtil singleton. 2021-10-22 19:06:15 -03:00
Matthew Chen
a0efdc2e95 Respond to CR. 2021-10-21 09:21:33 -03:00
Matthew Chen
91ad7d1df7 Respond to CR. 2021-10-21 09:21:31 -03:00
Matthew Chen
5d780d1589 Apply script to normalize includes and imports. 2021-10-21 09:21:10 -03:00
Matthew Chen
1b21755455 Simplify AFNetworking usage. 2021-10-15 10:50:37 -03:00
Matthew Chen
997f354f74 Only warn in logs when duplicate decryptions occur. 2021-09-28 17:22:17 -03:00
Matthew Chen
c01b04c3c8 Improve logging around message processing. 2021-09-28 17:22:17 -03:00
Matthew Chen
fc45ec8f63 Refine de-duplication logic. 2021-09-24 18:30:42 -03:00
Matthew Chen
ee8f3dddb8 Merge branch 'release/5.20.4' 2021-09-23 23:51:34 -03:00
Matthew Chen
ad1bdf48d6 Refine decrypt deduplication. 2021-09-23 23:16:41 -03:00
Matthew Chen
ddd7a9949a Refine decrypt deduplication. 2021-09-23 23:08:05 -03:00
Matthew Chen
59e33de962 Refine decrypt deduplication. 2021-09-23 22:49:44 -03:00
Michelle Linington
e2e48fd749 Fix test compilation 2021-09-23 09:56:03 -03:00
Michelle Linington
6cb440dc26 Fix tests 2021-09-23 09:56:02 -03:00
Michelle Linington
a9121b9ea3 Fix test compilation 2021-09-23 09:56:02 -03:00
Matthew Chen
c4777a8023 Merge branch 'release/5.20.4' 2021-09-23 00:18:58 -03:00
Matthew Chen
1b46d06336 De-duplicate by serverGuid. 2021-09-23 00:08:02 -03:00
Matthew Chen
026b02c267 Deduplication message decryption to avoid spurious errors when NSE and main app message processing race. 2021-09-23 00:08:02 -03:00
Matthew Chen
220877f287 Merge branch 'release/5.20.4' 2021-09-22 18:19:17 -03:00
Matthew Chen
8aa213d25b Deduplication message decryption to avoid spurious errors when NSE and main app message processing race. 2021-09-22 12:05:28 -07:00
Matthew Chen
4df6394564 Fix broken tests. 2021-09-20 17:51:16 -03:00
Matthew Chen
9271f83624 Remove databaseChangesWillUpdate. 2021-09-08 21:41:13 -03:00
Matthew Chen
c1a8005a74 Never emit invalid e164 in storage service contact records; be robust to invalid e164 incoming protos. 2021-09-01 16:33:16 -03:00
Michelle Linington
c7fb7b2032 Fix broken test 2021-09-01 11:42:34 -07:00
Michelle Linington
4eeb4e34be Tests should be runnable in Profiling scheme 2021-08-26 20:57:06 -07:00
Michelle Linington
8bcf7d39ff Timestamp mismatch between envelope inside and outside
On a resend response, when fetching the proto payload from the MSL, some
incorrect float math led to an off-by-one timestamp for some timestamps.

One example is the timestamp 1629210680140. When converting to a date:
1629210680140 / 1000.0 = 1629210680.1399999

Then when converting back to milliseconds:
Int(1629210680.1399999 * 1000.0) = 1629210680139

To fix this, the MSL now only operates with UInt64 millisecond
timestamps.
2021-08-19 17:01:05 -07:00
Michelle Linington
6417494bc3 Fix tests 2021-08-19 16:54:29 -07:00
Matthew Chen
4b77df38fa Refine names. 2021-08-18 15:01:04 -03:00
Matthew Chen
b28131de13 Refine error localizedDescription. 2021-08-18 15:01:03 -03:00
Matthew Chen
fb549a95ea Refine error localizedDescription. 2021-08-18 15:01:03 -03:00
Matthew Chen
e13657952b Respond to CR; fix broken tests. 2021-08-18 14:26:20 -03:00
Matthew Chen
05bf2b86b9 Clean up ahead of PR. 2021-08-18 14:25:40 -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
Nora Trapp
1cbe9c3ee7 PR Feedback 2021-08-16 13:28:08 -07:00
Michelle Linington
8ced863098 Fix a bug with date comparison. Added tests 2021-08-16 13:14:19 -07:00
Michelle Linington
c1f80c143d Lint 2021-08-16 13:14:19 -07:00
Michelle Linington
93d584b239 IOS-1718: Foreign constraint failure on MessageSendLog
Fixes a bug where a incoming delivery receipt can race with an
in-progress send.

- When a message is preparing to be sent, a payload is inserted
- As sends are successful, recipient entries are added to indicate that
  we're awaiting delivery acknowledgement.
- Once all recipient entries have been cleared (every recipient has
  acked), we delete the payload.

If a message is being sent to A and B: A succeeds, but B is delayed, and
A acks before B can be sent, the payload entry will be cleared.

This change adds a "sendComplete" bit to the MSL table to indicate
whether or not the entry should be preserved even if all recipients have
acked.
2021-08-16 13:14:19 -07:00
Michelle Linington
1788e4a4fb Fixes a crash in OWSReceiptManager
Dictionary(uniqueKeysWithValues:) will assert that the provided keys are
unique and crash if a violation occurs. The existing code in
OWSReceiptManager falsely assumes that the addresses being built are
unique.

The keys in the key value store *are* unique, but as they're mapped into
addresses, we may have learned of a high trust e164/UUID mapping since
they were inserted. As the identifiers are mapped into
SignalServiceAddresses, the e164 and UUID are mapped to the same
SignalServiceAddress.

The fix is to just wrap our address builder in a Set() so we only have
one copy for each address.
2021-08-09 21:43:06 -03:00
Michelle Linington
4952320106 Fix comment 2021-07-29 20:39:06 -07:00
Michelle Linington
4c3e30ea4b Add tests to exercise the MessageSendLog 2021-07-29 20:37:21 -07:00
Michelle Linington
8636769dfb Trim the MessageSendLog
- Recipients that return a delivery receipt will be removed from the MSL
- The MSL will clear out stale payloads ~24 hours
2021-07-29 15:08:59 -07:00
Matthew Chen
cea3b7ce53 Fix broken test. 2021-07-13 22:16:32 -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