@@ -1333,13 +1333,14 @@ sub dehuff {
1333
1333
}
1334
1334
1335
1335
sub raw_write {
1336
- my ($self , $message ) = @_ ;
1336
+ my ($self , $message , $level ) = @_ ;
1337
+ $level = 3 if !defined $level ;
1337
1338
1338
1339
if ($self -> {chaining }) {
1339
- return add_chain($self , $message );
1340
+ return add_chain($self , $message , $level );
1340
1341
}
1341
1342
1342
- $self -> {socket }-> syswrite ($self -> encrypt_aead($message , 3 ));
1343
+ $self -> {socket }-> syswrite ($self -> encrypt_aead($message , $level ));
1343
1344
}
1344
1345
1345
1346
sub start_chain {
@@ -1349,20 +1350,24 @@ sub start_chain {
1349
1350
}
1350
1351
1351
1352
sub add_chain {
1352
- my ($self , $buf ) = @_ ;
1353
+ my ($self , $buf , $level ) = @_ ;
1353
1354
1354
- if ($self -> {chained_buf }) {
1355
- $self -> {chained_buf } .= $buf ;
1355
+ if ($self -> {chained_buf }{ $level } ) {
1356
+ $self -> {chained_buf }{ $level } .= $buf ;
1356
1357
} else {
1357
- $self -> {chained_buf } = $buf ;
1358
+ $self -> {chained_buf }{ $level } = $buf ;
1358
1359
}
1359
1360
}
1360
1361
1361
1362
sub send_chain {
1362
1363
my ($self ) = @_ ;
1363
1364
1364
1365
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 ;
1366
1371
undef $self -> {chained_buf };
1367
1372
}
1368
1373
0 commit comments