Skip to content

Commit 8a6d695

Browse files
authored
Add frame stats to for path status frames (#94)
2 parents afb6bd2 + f7682ba commit 8a6d695

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

quinn-proto/src/connection/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4143,7 +4143,7 @@ impl Connection {
41434143
error_code,
41444144
}
41454145
.encode(buf);
4146-
// TODO(flub): frame stats?
4146+
self.stats.frame_tx.path_abandon += 1;
41474147
}
41484148

41494149
// PATH_AVAILABLE & PATH_BACKUP
@@ -4164,6 +4164,7 @@ impl Connection {
41644164
status_seq_no: seq,
41654165
}
41664166
.encode(buf);
4167+
self.stats.frame_tx.path_available += 1;
41674168
trace!(?path_id, %seq, "PATH_AVAILABLE")
41684169
}
41694170
PathStatus::Backup => {
@@ -4172,10 +4173,10 @@ impl Connection {
41724173
status_seq_no: seq,
41734174
}
41744175
.encode(buf);
4176+
self.stats.frame_tx.path_backup += 1;
41754177
trace!(?path_id, %seq, "PATH_BACKUP")
41764178
}
41774179
}
4178-
// TODO(flub): frame stats?
41794180
}
41804181

41814182
// RESET_STREAM, STOP_SENDING, MAX_DATA, MAX_STREAM_DATA, MAX_STREAMS

quinn-proto/src/tests/multipath.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,16 @@ fn path_status() {
110110
server_conn.remote_path_status(PathId::ZERO).unwrap(),
111111
PathStatus::Backup
112112
);
113+
114+
let client_stats = pair.client_conn_mut(client_ch).stats();
115+
assert_eq!(client_stats.frame_tx.path_available, 0);
116+
assert_eq!(client_stats.frame_tx.path_backup, 1);
117+
assert_eq!(client_stats.frame_rx.path_available, 0);
118+
assert_eq!(client_stats.frame_rx.path_backup, 0);
119+
120+
let server_stats = pair.server_conn_mut(server_ch).stats();
121+
assert_eq!(server_stats.frame_tx.path_available, 0);
122+
assert_eq!(server_stats.frame_tx.path_backup, 0);
123+
assert_eq!(server_stats.frame_rx.path_available, 0);
124+
assert_eq!(server_stats.frame_rx.path_backup, 1);
113125
}

0 commit comments

Comments
 (0)