Signal-iOS/SignalServiceKit
Max Radermacher fe077c5e33
Fix web socket bugs & add close reason
* Add & use WebSocketError type

Previously, there were separate errors thrown for Starscream and native
web sockets. Now, they both throw `WebSocketError`s.

Also, if there’s a "Retry-After" header, we’ll include it on errors.

* Use coarser lock in SSKWebSocketNative

This isn’t strictly required, but it makes the class easier to reason
about, and it fixes a bug where writing to a web socket while that
socket is being closed normally could allow the write error to be
reported instead of the close error.

* Fix web socket close/final message race condition

There’s a comment in the code that describes the fix.

In addition, this updates the native web socket to only post the first
error that occurs. Both of the existing web socket implementations
(OWSWebSocket & ProvisioningSocket) are written in such a way that these
subsequent errors would be ignored, and it makes future code simpler if
there’s at most one error that gets reported.

* Make error required in web socket close delegate

Before this change, the error was never nil when using the native
socket, which is the implementation we use on iOS 13+. This change
ensures it’s never nil on iOS 12, which improves consistency.

In addition, this updates the iOS 12 implementation to skip reporting
error if the user has explicitly requested the connection be closed,
which also mimics the behavior on iOS 13+.
2022-11-30 14:35:22 -08:00
..
Experience Upgrades Fix crash when fetching remote megaphones 2022-11-17 12:21:54 -08:00
Jobs Add all JobQueues to environment, via a wrapper 2022-11-09 14:08:44 -06:00
protobuf Move system contact names to ContactRecord 2022-10-26 15:00:36 -07:00
Resources Remove old CA certificate 2022-11-30 14:31:25 -08:00
src Fix web socket bugs & add close reason 2022-11-30 14:35:22 -08:00
tests Fix SwiftLint violations 2022-11-29 14:47:23 -08:00
.clang-format Update clang-format with AllowShortEnumsOnASingleLine: false 2022-03-14 11:20:20 -07:00
.gitignore
.travis.yml
SignalServiceKit-Prefix.pch Change license to AGPL 2022-10-13 08:25:37 -05:00
SignalServiceKit.h Swiftify test-only call message handler 2022-11-10 12:46:13 -06:00