Remove expect and received flight hooks.
Instead, the DTLS driver can detect these states implicitly based on
when we write flights and when the handshake completes. When we flush a
new flight, the peer has enough information to send their reply, so we
start a timer. When we begin assembling a new flight, we must have
received the final message in the peer's flight. (If there are
asynchronous events between, we may stop the timer later, but we may
freely stop the timer anytime before we next try to read something.)
The only place this fails is if we were the last to write a flight,
we'll have a stray timer. Clear it in a handshake completion hook.
Change-Id: I973c592ee5721192949a45c259b93192fa309edb
Reviewed-on: https://boringssl-review.googlesource.com/18864
Reviewed-by: Steven Valdez <svaldez@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/ssl/handshake_client.cc b/ssl/handshake_client.cc
index 2a3e627..946316d 100644
--- a/ssl/handshake_client.cc
+++ b/ssl/handshake_client.cc
@@ -238,7 +238,6 @@
goto end;
}
if (ssl->d1->send_cookie) {
- ssl->method->received_flight(ssl);
hs->state = SSL3_ST_CW_CLNT_HELLO_A;
} else {
hs->state = SSL3_ST_CR_SRVR_HELLO_A;
@@ -333,7 +332,6 @@
if (ret <= 0) {
goto end;
}
- ssl->method->received_flight(ssl);
hs->state = SSL3_ST_CW_CERT_A;
break;
@@ -460,7 +458,6 @@
if (ret <= 0) {
goto end;
}
- ssl->method->received_flight(ssl);
if (ssl->session != NULL) {
hs->state = SSL3_ST_CW_CHANGE;
@@ -475,9 +472,6 @@
goto end;
}
hs->state = hs->next_state;
- if (hs->state != SSL3_ST_FINISH_CLIENT_HANDSHAKE) {
- ssl->method->expect_flight(ssl);
- }
break;
case SSL_ST_TLS13: {
@@ -497,6 +491,7 @@
}
case SSL3_ST_FINISH_CLIENT_HANDSHAKE:
+ ssl->method->on_handshake_complete(ssl);
ssl->method->release_current_message(ssl, 1 /* free_buffer */);
SSL_SESSION_free(ssl->s3->established_session);