summaryrefslogtreecommitdiffstats
path: root/third_party/rust/neqo-transport/src/connection/tests/close.rs
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/neqo-transport/src/connection/tests/close.rs')
-rw-r--r--third_party/rust/neqo-transport/src/connection/tests/close.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/third_party/rust/neqo-transport/src/connection/tests/close.rs b/third_party/rust/neqo-transport/src/connection/tests/close.rs
index 5351dd0d5c..7c620de17e 100644
--- a/third_party/rust/neqo-transport/src/connection/tests/close.rs
+++ b/third_party/rust/neqo-transport/src/connection/tests/close.rs
@@ -14,13 +14,13 @@ use super::{
};
use crate::{
tparams::{self, TransportParameter},
- AppError, ConnectionError, Error, ERROR_APPLICATION_CLOSE,
+ AppError, CloseReason, Error, ERROR_APPLICATION_CLOSE,
};
fn assert_draining(c: &Connection, expected: &Error) {
assert!(c.state().closed());
if let State::Draining {
- error: ConnectionError::Transport(error),
+ error: CloseReason::Transport(error),
..
} = c.state()
{
@@ -40,7 +40,14 @@ fn connection_close() {
client.close(now, 42, "");
+ let stats_before = client.stats().frame_tx;
let out = client.process(None, now);
+ let stats_after = client.stats().frame_tx;
+ assert_eq!(
+ stats_after.connection_close,
+ stats_before.connection_close + 1
+ );
+ assert_eq!(stats_after.ack, stats_before.ack + 1);
server.process_input(&out.dgram().unwrap(), now);
assert_draining(&server, &Error::PeerApplicationError(42));
@@ -57,7 +64,14 @@ fn connection_close_with_long_reason_string() {
let long_reason = String::from_utf8([0x61; 2048].to_vec()).unwrap();
client.close(now, 42, long_reason);
+ let stats_before = client.stats().frame_tx;
let out = client.process(None, now);
+ let stats_after = client.stats().frame_tx;
+ assert_eq!(
+ stats_after.connection_close,
+ stats_before.connection_close + 1
+ );
+ assert_eq!(stats_after.ack, stats_before.ack + 1);
server.process_input(&out.dgram().unwrap(), now);
assert_draining(&server, &Error::PeerApplicationError(42));
@@ -100,7 +114,7 @@ fn bad_tls_version() {
let dgram = server.process(dgram.as_ref(), now()).dgram();
assert_eq!(
*server.state(),
- State::Closed(ConnectionError::Transport(Error::ProtocolViolation))
+ State::Closed(CloseReason::Transport(Error::ProtocolViolation))
);
assert!(dgram.is_some());
client.process_input(&dgram.unwrap(), now());
@@ -154,7 +168,6 @@ fn closing_and_draining() {
assert!(client_close.is_some());
let client_close_timer = client.process(None, now()).callback();
assert_ne!(client_close_timer, Duration::from_secs(0));
-
// The client will spit out the same packet in response to anything it receives.
let p3 = send_something(&mut server, now());
let client_close2 = client.process(Some(&p3), now()).dgram();
@@ -168,7 +181,7 @@ fn closing_and_draining() {
assert_eq!(end, Output::None);
assert_eq!(
*client.state(),
- State::Closed(ConnectionError::Application(APP_ERROR))
+ State::Closed(CloseReason::Application(APP_ERROR))
);
// When the server receives the close, it too should generate CONNECTION_CLOSE.
@@ -186,7 +199,7 @@ fn closing_and_draining() {
assert_eq!(end, Output::None);
assert_eq!(
*server.state(),
- State::Closed(ConnectionError::Transport(Error::PeerApplicationError(
+ State::Closed(CloseReason::Transport(Error::PeerApplicationError(
APP_ERROR
)))
);