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 tickInterval = 0.2
static let pushRequestInterval = 2.0
static let pingTimeout = 120.0 static let pingTimeout = 120.0
static let retransmissionLimit = 0.1 static let retransmissionLimit = 0.1

View File

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