Clean up ahead of PR.

// FREEBIE
This commit is contained in:
Matthew Chen 2017-02-01 10:44:29 -05:00
parent d294557bdd
commit 49bb3d942d
5 changed files with 27 additions and 41 deletions

View File

@ -5,8 +5,7 @@ target 'Signal' do
pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git'
pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git'
#pod 'AxolotlKit', path: '../SignalProtocolKit'
#pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git', branch: 'mkirk/webrtc'
pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git', branch: 'charlesmchen/webrtc/threadSafety'
pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git', branch: 'mkirk/webrtc'
#pod 'SignalServiceKit', path: '../SignalServiceKit'
pod 'OpenSSL'
pod 'PastelogKit', '~> 1.3'

View File

@ -123,7 +123,7 @@ DEPENDENCIES:
- PastelogKit (~> 1.3)
- PureLayout
- SCWaveformView (~> 1.0)
- SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`, branch `charlesmchen/webrtc/threadSafety`)
- SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`, branch `mkirk/webrtc`)
- SocketRocket (from `https://github.com/facebook/SocketRocket.git`)
- ZXingObjC
@ -131,7 +131,7 @@ EXTERNAL SOURCES:
AxolotlKit:
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
SignalServiceKit:
:branch: charlesmchen/webrtc/threadSafety
:branch: mkirk/webrtc
:git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket:
:git: https://github.com/facebook/SocketRocket.git
@ -141,7 +141,7 @@ CHECKOUT OPTIONS:
:commit: 919d541d6b8a8802a94f943026b8f68394e2c0b8
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
SignalServiceKit:
:commit: ddbc4819f1aa10e0164c1591dfc12cba49e04ed0
:commit: 7ca1d5e8a62273b524281d905c560b08c7c22039
:git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket:
:commit: 41b57bb2fc292a814f758441a05243eb38457027
@ -173,6 +173,6 @@ SPEC CHECKSUMS:
YapDatabase: b1e43555a34a5298e23a045be96817a5ef0da58f
ZXingObjC: bf15b3814f7a105b6d99f47da2333c93a063650a
PODFILE CHECKSUM: beb37f2fe7d11b6d2a8124b03b20f903908fd8aa
PODFILE CHECKSUM: 9f2e2cf6d4db276e3d0280343260503d09c72979
COCOAPODS: 1.0.1

View File

@ -635,11 +635,7 @@ protocol CallServiceObserver: class {
callRecord.save()
let message = DataChannelMessage.forConnected(callId: call.signalingId)
peerConnectionClient.sendDataChannelMessage(data: message.asData()).then { _ in
Logger.debug("\(self.TAG) sendDataChannelMessage succeeded")
}.catch(on: DispatchQueue.main) { _ in
Logger.warn("\(self.TAG) sendDataChannelMessage failed")
}
peerConnectionClient.sendDataChannelMessage(data: message.asData())
handleConnectedCall(call)
}
@ -737,11 +733,7 @@ protocol CallServiceObserver: class {
// If the call is connected, we can send the hangup via the data channel.
let message = DataChannelMessage.forHangup(callId: call.signalingId)
peerConnectionClient.sendDataChannelMessage(data: message.asData()).then { _ in
Logger.debug("\(self.TAG) sendDataChannelMessage succeeded")
}.catch(on: DispatchQueue.main) { _ in
Logger.warn("\(self.TAG) sendDataChannelMessage failed")
}
peerConnectionClient.sendDataChannelMessage(data: message.asData())
// If the call hasn't started yet, we don't have a data channel to communicate the hang up. Use Signal Service Message.
let hangupMessage = OWSCallHangupMessage(callId: call.signalingId)
@ -1075,11 +1067,7 @@ protocol CallServiceObserver: class {
self.peerConnectionClient?.setLocalVideoEnabled(enabled: shouldHaveLocalVideoTrack)
let message = DataChannelMessage.forVideoStreamingStatus(callId: call.signalingId, enabled:shouldHaveLocalVideoTrack)
peerConnectionClient.sendDataChannelMessage(data: message.asData()).then { _ in
Logger.debug("\(self.TAG) sendDataChannelMessage succeeded")
}.catch(on: DispatchQueue.main) { _ in
Logger.warn("\(self.TAG) sendDataChannelMessage failed")
}
peerConnectionClient.sendDataChannelMessage(data: message.asData())
}
// MARK: - Observers

View File

@ -18,6 +18,8 @@ let kMediaConstraintsMaxHeight = kRTCMediaConstraintsMaxHeight
/**
* The PeerConnectionClient notifies it's delegate (the CallService) of key events in the call signaling life cycle
*
* The delegate's methods will always be called on the main thread.
*/
protocol PeerConnectionClientDelegate: class {
@ -143,7 +145,7 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD
public func createSignalingDataChannel() {
AssertIsOnMainThread()
PeerConnectionClient.signalingQueue.sync {
let dataChannel = peerConnection.dataChannel(forLabel: Identifiers.dataChannelSignaling.rawValue,
configuration: RTCDataChannelConfiguration())
@ -404,24 +406,24 @@ class PeerConnectionClient: NSObject, RTCPeerConnectionDelegate, RTCDataChannelD
// MARK: - Data Channel
public func sendDataChannelMessage(data: Data) -> Promise<Bool> {
public func sendDataChannelMessage(data: Data) {
AssertIsOnMainThread()
return Promise { fulfill, reject in
AssertIsOnMainThread()
PeerConnectionClient.signalingQueue.async {
self.assertOnSignalingQueue()
guard let dataChannel = self.dataChannel else {
Logger.error("\(self.TAG) in \(#function) ignoring sending \(data) for nil dataChannel")
reject(OWSErrorMakeWebRTCMissingDataChannelError())
return
}
let buffer = RTCDataBuffer(data: data, isBinary: false)
let result = dataChannel.sendData(buffer)
fulfill(result)
PeerConnectionClient.signalingQueue.async {
self.assertOnSignalingQueue()
guard let dataChannel = self.dataChannel else {
Logger.error("\(self.TAG) in \(#function) ignoring sending \(data) for nil dataChannel")
return
}
let buffer = RTCDataBuffer(data: data, isBinary: false)
let result = dataChannel.sendData(buffer)
if result {
Logger.debug("\(self.TAG) sendDataChannelMessage succeeded")
} else {
Logger.warn("\(self.TAG) sendDataChannelMessage failed")
}
}
}

View File

@ -250,9 +250,6 @@
/* Error message when attempting to send message */
"ERROR_DESCRIPTION_UNREGISTERED_RECIPIENT" = "Recipient is no longer a Signal user.";
/* Missing data channel while trying to sending message */
"ERROR_DESCRIPTION_WEBRTC_MISSING_DATA_CHANNEL" = "Missing connection";
/* No comment provided by engineer. */
"ERROR_MESSAGE_DUPLICATE_MESSAGE" = "Received a duplicated message.";