SRSLTE: RLC AM remove completely overlapped segments

This commit is contained in:
Xavier Arteaga 2020-01-23 11:14:32 +01:00 committed by Xavier Arteaga
parent 39bec9aab1
commit 5872e763bf
1 changed files with 11 additions and 3 deletions

View File

@ -1715,14 +1715,22 @@ bool rlc_am_lte::rlc_am_lte_rx::add_segment_and_check(rlc_amd_rx_pdu_segments_t*
// Check for complete
uint32_t so = 0;
std::list<rlc_amd_rx_pdu_t>::iterator it, tmpit;
for (it = pdu->segments.begin(); it != pdu->segments.end(); it++) {
for (it = pdu->segments.begin(); it != pdu->segments.end(); /* Do not increment */) {
// Check that there is no gap between last segment and current; overlap allowed
if (so < it->header.so) {
// return
return false;
}
// Update segment offset it shall not go backwards
so = SRSLTE_MAX(so, it->header.so + it->buf->N_bytes);
// Check if segment is overlapped
if (it->header.so + it->buf->N_bytes <= so) {
// completely overlapped with previous segments, erase
it = pdu->segments.erase(it); // Returns next iterator
} else {
// Update segment offset it shall not go backwards
so = SRSLTE_MAX(so, it->header.so + it->buf->N_bytes);
it++; // Increments iterator
}
}
// Check for last segment flag available