Resend PUSH_REQUEST every 2 seconds

Regardless of link reliability.
This commit is contained in:
Davide De Rosa 2019-04-16 12:42:38 +02:00
parent ad964e2041
commit d097afccdc
2 changed files with 9 additions and 16 deletions

View File

@ -67,6 +67,8 @@ struct CoreConfiguration {
static let tickInterval = 0.2
static let pushRequestInterval = 2.0
static let pingTimeout = 120.0
static let retransmissionLimit = 0.1

View File

@ -403,12 +403,10 @@ public class SessionProxy {
return
}
if !isReliableLink {
pushRequest()
flushControlQueue()
}
pushRequest()
flushControlQueue()
guard (negotiationKey.controlState == .connected) else {
guard negotiationKey.controlState == .connected else {
queue.asyncAfter(deadline: .now() + CoreConfiguration.tickInterval) { [weak self] in
self?.loopNegotiation()
}
@ -696,13 +694,11 @@ public class SessionProxy {
// Ruby: push_request
private func pushRequest() {
guard (negotiationKey.controlState == .preIfConfig) else {
guard negotiationKey.controlState == .preIfConfig else {
return
}
if !isReliableLink {
guard let targetDate = nextPushRequestDate, (Date() > targetDate) else {
return
}
guard let targetDate = nextPushRequestDate, Date() > targetDate else {
return
}
log.debug("TLS.ifconfig: Put plaintext (PUSH_REQUEST)")
@ -727,7 +723,7 @@ public class SessionProxy {
if negotiationKey.softReset {
completeConnection()
}
nextPushRequestDate = Date().addingTimeInterval(CoreConfiguration.retransmissionLimit)
nextPushRequestDate = Date().addingTimeInterval(CoreConfiguration.pushRequestInterval)
}
private func maybeRenegotiate() {
@ -1143,11 +1139,6 @@ public class SessionProxy {
// MARK: Acks
private func handleAcks() {
// retry PUSH_REQUEST if ack queue is empty (all sent packets were ack'ed)
if isReliableLink && !controlChannel.hasPendingAcks() {
pushRequest()
}
}
// Ruby: send_ack