Skip to content

Commit 7895728

Browse files
committed
Tests: QUIC packets buffering support across encryption levels.
For simplicity, this doesn't include ACKs buffering.
1 parent b77e3f8 commit 7895728

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/Test/Nginx/HTTP3.pm

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,13 +1333,14 @@ sub dehuff {
13331333
}
13341334

13351335
sub raw_write {
1336-
my ($self, $message) = @_;
1336+
my ($self, $message, $level) = @_;
1337+
$level = 3 if !defined $level;
13371338

13381339
if ($self->{chaining}) {
1339-
return add_chain($self, $message);
1340+
return add_chain($self, $message, $level);
13401341
}
13411342

1342-
$self->{socket}->syswrite($self->encrypt_aead($message, 3));
1343+
$self->{socket}->syswrite($self->encrypt_aead($message, $level));
13431344
}
13441345

13451346
sub start_chain {
@@ -1349,20 +1350,24 @@ sub start_chain {
13491350
}
13501351

13511352
sub add_chain {
1352-
my ($self, $buf) = @_;
1353+
my ($self, $buf, $level) = @_;
13531354

1354-
if ($self->{chained_buf}) {
1355-
$self->{chained_buf} .= $buf;
1355+
if ($self->{chained_buf}{$level}) {
1356+
$self->{chained_buf}{$level} .= $buf;
13561357
} else {
1357-
$self->{chained_buf} = $buf;
1358+
$self->{chained_buf}{$level} = $buf;
13581359
}
13591360
}
13601361

13611362
sub send_chain {
13621363
my ($self) = @_;
13631364

13641365
undef $self->{chaining};
1365-
$self->raw_write($self->{chained_buf}) if $self->{chained_buf};
1366+
my $buf = join '', map {
1367+
$self->encrypt_aead($self->{chained_buf}{$_}, $_)
1368+
if defined $self->{chained_buf}{$_}
1369+
} 0 .. 3;
1370+
$self->{socket}->syswrite($buf) if $buf;
13661371
undef $self->{chained_buf};
13671372
}
13681373

0 commit comments

Comments
 (0)