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 var pendingAcks: Set<UInt32>
|
||||||
|
|
||||||
private(set) var plainBuffer: ZeroingData
|
private var plainBuffer: ZeroingData
|
||||||
|
|
||||||
private var dataCount: BidirectionalState<Int>
|
private var dataCount: BidirectionalState<Int>
|
||||||
|
|
||||||
@ -59,6 +59,12 @@ class ControlChannel {
|
|||||||
return !pendingAcks.isEmpty
|
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) {
|
func addReceivedDataCount(_ count: Int) {
|
||||||
dataCount.inbound += count
|
dataCount.inbound += count
|
||||||
}
|
}
|
||||||
|
@ -806,10 +806,7 @@ public class SessionProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
var length = 0
|
let controlData = try controlChannel.currentControlData(withTLS: negotiationKey.tls)
|
||||||
try negotiationKey.tls.pullRawPlainText(controlChannel.plainBuffer.mutableBytes, length: &length)
|
|
||||||
|
|
||||||
let controlData = controlChannel.plainBuffer.withOffset(0, count: length)
|
|
||||||
handleControlData(controlData)
|
handleControlData(controlData)
|
||||||
} catch _ {
|
} catch _ {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user