Skip to content

Commit dc16d6d

Browse files
frankistcodebot
authored andcommitted
fix race condition in DRB stop
1 parent 6663e05 commit dc16d6d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/du_manager/du_ue/du_ue_adapters.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,9 @@ class rlc_tx_mac_buffer_state_updater : public rlc_tx_lower_layer_notifier
229229

230230
void disconnect()
231231
{
232-
lcid_t prev_lcid = lcid.exchange(INVALID_LCID);
233-
if (prev_lcid != INVALID_LCID) {
232+
if (connected.exchange(false, std::memory_order_relaxed)) {
234233
// Push an empty buffer state update to MAC, so the scheduler doesn't keep allocating grants for this bearer.
235-
mac->handle_dl_buffer_state_update(mac_dl_buffer_state_indication_message{ue_index, prev_lcid, 0});
234+
mac->handle_dl_buffer_state_update(mac_dl_buffer_state_indication_message{ue_index, lcid, 0});
236235
}
237236
}
238237

@@ -241,18 +240,19 @@ class rlc_tx_mac_buffer_state_updater : public rlc_tx_lower_layer_notifier
241240
srsran_assert(mac != nullptr, "RLC Tx Buffer State notifier is disconnected");
242241
mac_dl_buffer_state_indication_message bs{};
243242
bs.ue_index = ue_index;
244-
bs.lcid = lcid.load(std::memory_order_relaxed);
243+
bs.lcid = lcid;
245244
bs.bs = bsr;
246-
if (SRSRAN_UNLIKELY(bs.lcid == INVALID_LCID)) {
245+
if (SRSRAN_UNLIKELY(not connected.load(std::memory_order_relaxed))) {
247246
// Discard.
248-
return;
247+
bs.bs = 0;
249248
}
250249
mac->handle_dl_buffer_state_update(bs);
251250
}
252251

253252
private:
254253
du_ue_index_t ue_index = INVALID_DU_UE_INDEX;
255-
std::atomic<lcid_t> lcid{INVALID_LCID};
254+
std::atomic<bool> connected{true};
255+
lcid_t lcid;
256256
mac_ue_control_information_handler* mac = nullptr;
257257
};
258258

0 commit comments

Comments
 (0)