Skip to content

Commit aa6c373

Browse files
flubmatheus23
andauthored
fix: Do not send off-path data when closing (#358)
* fix: Do not send off-path data when closing When we are closing we're only supposed to send packets containing CONNECTION_CLOSE and (PATH_)ACK frames. There is no need to continue sending any off-path data. * maybe fix * revert that. it was wrong * Apply suggestion from @matheus23 Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com> --------- Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
1 parent c38be74 commit aa6c373

File tree

1 file changed

+7
-5
lines changed
  • quinn-proto/src/connection

1 file changed

+7
-5
lines changed

quinn-proto/src/connection/mod.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ impl Connection {
10221022
// datagrams for one destination address are produced for each poll_transmit call.
10231023

10241024
// Check whether we need to send a close message
1025-
let close = match self.state.as_type() {
1025+
let connection_close_pending = match self.state.as_type() {
10261026
StateType::Drained => {
10271027
self.app_limited = true;
10281028
return None;
@@ -1091,7 +1091,9 @@ impl Connection {
10911091
let mut congestion_blocked = false;
10921092

10931093
for &path_id in &path_ids {
1094-
if let Some(transmit) = self.poll_transmit_off_path(now, buf, path_id) {
1094+
if !connection_close_pending
1095+
&& let Some(transmit) = self.poll_transmit_off_path(now, buf, path_id)
1096+
{
10951097
return Some(transmit);
10961098
}
10971099

@@ -1102,7 +1104,7 @@ impl Connection {
11021104
path_id,
11031105
max_datagrams,
11041106
have_available_path,
1105-
close,
1107+
connection_close_pending,
11061108
) {
11071109
PollPathStatus::Send(transmit) => {
11081110
return Some(transmit);
@@ -1214,7 +1216,7 @@ impl Connection {
12141216
path_id: PathId,
12151217
max_datagrams: NonZeroUsize,
12161218
have_available_path: bool,
1217-
close: bool,
1219+
connection_close_pending: bool,
12181220
) -> PollPathStatus {
12191221
// Check if there is at least one active CID to use for sending
12201222
let Some(remote_cid) = self.remote_cids.get(&path_id).map(CidQueue::active) else {
@@ -1259,7 +1261,7 @@ impl Connection {
12591261
space_id,
12601262
remote_cid,
12611263
have_available_path,
1262-
close,
1264+
connection_close_pending,
12631265
pad_datagram,
12641266
) {
12651267
PollPathSpaceStatus::NothingToSend {

0 commit comments

Comments
 (0)