runner: Move receivedFlightRecords tracking up a layer

If the test runner discovers a handshake record by trying to read
application data, it loses track of that record and never ACK it.

This fixes one of the many issues in the way of testing post-handshake
message retransmit.

Bug: 42290594
Change-Id: Ic74a91f640484aa3ca71b52a05b8aaa072480f36
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/73229
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Nick Harper <nharper@chromium.org>
diff --git a/ssl/test/runner/conn.go b/ssl/test/runner/conn.go
index 3a19810..d516651 100644
--- a/ssl/test/runner/conn.go
+++ b/ssl/test/runner/conn.go
@@ -1174,6 +1174,13 @@
 		if pack := c.config.Bugs.ExpectPackedEncryptedHandshake; pack > 0 && len(data) < pack && c.out.epoch.cipher != nil {
 			c.seenHandshakePackEnd = true
 		}
+		if c.isDTLS {
+			record, err := c.makeDTLSRecordNumberInfo(&c.in.epoch, c.hand.Bytes())
+			if err != nil {
+				return err
+			}
+			c.receivedFlightRecords = append(c.receivedFlightRecords, record)
+		}
 
 	case recordTypeACK:
 		if typ != want || !c.isDTLS {
diff --git a/ssl/test/runner/dtls.go b/ssl/test/runner/dtls.go
index 9bc466f..f56c44d 100644
--- a/ssl/test/runner/dtls.go
+++ b/ssl/test/runner/dtls.go
@@ -674,11 +674,6 @@
 			if err := c.readRecord(recordTypeHandshake); err != nil {
 				return nil, err
 			}
-			record, err := c.makeDTLSRecordNumberInfo(&c.in.epoch, c.hand.Bytes())
-			if err != nil {
-				return nil, err
-			}
-			c.receivedFlightRecords = append(c.receivedFlightRecords, record)
 		}
 
 		// Read the next fragment. It must fit entirely within