mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 07:08:19 +00:00
Use DataBlock value instead of pointer in reassembly map
This commit is contained in:
parent
e1e779e90b
commit
69d1620374
6 changed files with 169 additions and 129 deletions
|
@ -29,11 +29,11 @@ uint64_t FileReassembler::Flush()
|
|||
if ( block_list.Empty() )
|
||||
return 0;
|
||||
|
||||
auto last_block = std::prev(block_list.End())->second;
|
||||
const auto& last_block = std::prev(block_list.End())->second;
|
||||
|
||||
// This is expected to call back into FileReassembler::Undelivered().
|
||||
flushing = true;
|
||||
uint64_t rval = TrimToSeq(last_block->upper);
|
||||
uint64_t rval = TrimToSeq(last_block.upper);
|
||||
flushing = false;
|
||||
return rval;
|
||||
}
|
||||
|
@ -52,24 +52,24 @@ uint64_t FileReassembler::FlushTo(uint64_t sequence)
|
|||
|
||||
void FileReassembler::BlockInserted(DataBlockMap::const_iterator it)
|
||||
{
|
||||
auto start_block = it->second;
|
||||
const auto& start_block = it->second;
|
||||
|
||||
if ( start_block->seq > last_reassem_seq ||
|
||||
start_block->upper <= last_reassem_seq )
|
||||
if ( start_block.seq > last_reassem_seq ||
|
||||
start_block.upper <= last_reassem_seq )
|
||||
return;
|
||||
|
||||
while ( it != block_list.End() )
|
||||
{
|
||||
auto b = it->second;
|
||||
const auto& b = it->second;
|
||||
|
||||
if ( b->seq > last_reassem_seq )
|
||||
if ( b.seq > last_reassem_seq )
|
||||
break;
|
||||
|
||||
if ( b->seq == last_reassem_seq )
|
||||
if ( b.seq == last_reassem_seq )
|
||||
{ // New stuff.
|
||||
uint64_t len = b->Size();
|
||||
uint64_t len = b.Size();
|
||||
last_reassem_seq += len;
|
||||
the_file->DeliverStream(b->block, len);
|
||||
the_file->DeliverStream(b.block, len);
|
||||
}
|
||||
|
||||
++it;
|
||||
|
@ -86,21 +86,21 @@ void FileReassembler::Undelivered(uint64_t up_to_seq)
|
|||
|
||||
while ( it != block_list.End() )
|
||||
{
|
||||
auto b = it->second;
|
||||
const auto& b = it->second;
|
||||
|
||||
if ( b->seq < last_reassem_seq )
|
||||
if ( b.seq < last_reassem_seq )
|
||||
{
|
||||
// Already delivered this block.
|
||||
++it;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( b->seq >= up_to_seq )
|
||||
if ( b.seq >= up_to_seq )
|
||||
// Block is beyond what we need to process at this point.
|
||||
break;
|
||||
|
||||
uint64_t gap_at_seq = last_reassem_seq;
|
||||
uint64_t gap_len = b->seq - last_reassem_seq;
|
||||
uint64_t gap_len = b.seq - last_reassem_seq;
|
||||
the_file->Gap(gap_at_seq, gap_len);
|
||||
last_reassem_seq += gap_len;
|
||||
BlockInserted(it);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue