Move control data parsing
This commit is contained in:
parent
19ce7de819
commit
e6dd4de472
|
@ -35,7 +35,7 @@ class ControlChannel {
|
|||
|
||||
private var pendingAcks: Set<UInt32>
|
||||
|
||||
private(set) var plainBuffer: ZeroingData
|
||||
private var plainBuffer: ZeroingData
|
||||
|
||||
private var dataCount: BidirectionalState<Int>
|
||||
|
||||
|
@ -59,6 +59,12 @@ class ControlChannel {
|
|||
return !pendingAcks.isEmpty
|
||||
}
|
||||
|
||||
func currentControlData(withTLS tls: TLSBox) throws -> ZeroingData {
|
||||
var length = 0
|
||||
try tls.pullRawPlainText(plainBuffer.mutableBytes, length: &length)
|
||||
return plainBuffer.withOffset(0, count: length)
|
||||
}
|
||||
|
||||
func addReceivedDataCount(_ count: Int) {
|
||||
dataCount.inbound += count
|
||||
}
|
||||
|
|
|
@ -806,10 +806,7 @@ public class SessionProxy {
|
|||
}
|
||||
|
||||
do {
|
||||
var length = 0
|
||||
try negotiationKey.tls.pullRawPlainText(controlChannel.plainBuffer.mutableBytes, length: &length)
|
||||
|
||||
let controlData = controlChannel.plainBuffer.withOffset(0, count: length)
|
||||
let controlData = try controlChannel.currentControlData(withTLS: negotiationKey.tls)
|
||||
handleControlData(controlData)
|
||||
} catch _ {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue