protect PCAP bearer additions with write lock

master
Andre Puschmann 7 years ago
parent eb30d86d44
commit 2b86272c5e

@ -137,7 +137,7 @@ void pdcp::write_sdu_mch(uint32_t lcid, byte_buffer_t *sdu)
} }
void pdcp::add_bearer(uint32_t lcid, srslte_pdcp_config_t cfg) void pdcp::add_bearer(uint32_t lcid, srslte_pdcp_config_t cfg)
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
if (not valid_lcid(lcid)) { if (not valid_lcid(lcid)) {
if (not pdcp_array.insert(pdcp_map_pair_t(lcid, new pdcp_entity())).second) { if (not pdcp_array.insert(pdcp_map_pair_t(lcid, new pdcp_entity())).second) {
pdcp_log->error("Error inserting PDCP entity in to array\n."); pdcp_log->error("Error inserting PDCP entity in to array\n.");
@ -154,7 +154,7 @@ void pdcp::add_bearer(uint32_t lcid, srslte_pdcp_config_t cfg)
void pdcp::add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_t cfg) void pdcp::add_bearer_mrb(uint32_t lcid, srslte_pdcp_config_t cfg)
{ {
pthread_rwlock_rdlock(&rwlock); pthread_rwlock_wrlock(&rwlock);
if (not valid_mch_lcid(lcid)) { if (not valid_mch_lcid(lcid)) {
if (not pdcp_array_mrb.insert(pdcp_map_pair_t(lcid, new pdcp_entity())).second) { if (not pdcp_array_mrb.insert(pdcp_map_pair_t(lcid, new pdcp_entity())).second) {
pdcp_log->error("Error inserting PDCP entity in to array\n."); pdcp_log->error("Error inserting PDCP entity in to array\n.");

Loading…
Cancel
Save