@@ -33,14 +33,17 @@ UmTxEntity *LteRlcUm::lookupTxBuffer(MacCid cid)
3333 return (it != txEntities_.end ()) ? it->second : nullptr ;
3434}
3535
36- UmTxEntity *LteRlcUm::createTxBuffer (MacCid cid, inet::Ptr< FlowControlInfo> lteInfo)
36+ UmTxEntity *LteRlcUm::createTxBuffer (MacCid cid, FlowControlInfo * lteInfo)
3737{
38+ if (txEntities_.find (cid) != txEntities_.end ())
39+ throw cRuntimeError (" RLC-UM connection TX entity for %s already exists" , cid.str ().c_str ());
40+
3841 std::stringstream buf;
3942 buf << " UmTxEntity Lcid: " << cid.getLcid () << " cid: " << cid.asPackedInt ();
4043 UmTxEntity *txEnt = check_and_cast<UmTxEntity *>(txEntityModuleType_->createScheduleInit (buf.str ().c_str (), getParentModule ()));
4144 txEntities_[cid] = txEnt;
4245
43- txEnt->setFlowControlInfo (lteInfo. get () );
46+ txEnt->setFlowControlInfo (lteInfo);
4447
4548 EV << " LteRlcUm::createTxBuffer - Added new UmTxEntity: " << txEnt->getId () << " for CID " << cid << " \n " ;
4649
@@ -54,15 +57,18 @@ UmRxEntity *LteRlcUm::lookupRxBuffer(MacCid cid)
5457 return (it != rxEntities_.end ()) ? it->second : nullptr ;
5558}
5659
57- UmRxEntity *LteRlcUm::createRxBuffer (MacCid cid, inet::Ptr< FlowControlInfo> lteInfo)
60+ UmRxEntity *LteRlcUm::createRxBuffer (MacCid cid, FlowControlInfo * lteInfo)
5861{
62+ if (rxEntities_.find (cid) != rxEntities_.end ())
63+ throw cRuntimeError (" RLC-UM connection RX entity for %s already exists" , cid.str ().c_str ());
64+
5965 std::stringstream buf;
6066 buf << " UmRxEntity Lcid: " << cid.getLcid () << " cid: " << cid.asPackedInt ();
6167 UmRxEntity *rxEnt = check_and_cast<UmRxEntity *>(rxEntityModuleType_->createScheduleInit (buf.str ().c_str (), getParentModule ()));
6268 rxEntities_[cid] = rxEnt;
6369
6470 // configure entity
65- rxEnt->setFlowControlInfo (lteInfo. get () );
71+ rxEnt->setFlowControlInfo (lteInfo);
6672
6773 EV << " LteRlcUm::createRxBuffer - Added new UmRxEntity: " << rxEnt->getId () << " for CID " << cid << " \n " ;
6874
@@ -102,10 +108,10 @@ void LteRlcUm::handleUpperMessage(cPacket *pktAux)
102108 auto chunk = pkt->peekAtFront <inet::Chunk>();
103109 EV << " LteRlcUm::handleUpperMessage - Received packet " << chunk->getClassName () << " from upper layer, size " << pktAux->getByteLength () << " \n " ;
104110
105- MacCid cid = ctrlInfoToMacCid (lteInfo);
111+ MacCid cid = ctrlInfoToMacCid (lteInfo. get () );
106112 UmTxEntity *txbuf = lookupTxBuffer (cid);
107113 if (txbuf == nullptr )
108- txbuf = createTxBuffer (cid, lteInfo);
114+ txbuf = createTxBuffer (cid, lteInfo. get () );
109115
110116 // Create a new RLC packet
111117 auto rlcPkt = inet::makeShared<LteRlcSdu>();
@@ -150,10 +156,10 @@ void LteRlcUm::handleLowerMessage(cPacket *pktAux)
150156
151157 if (inet::dynamicPtrCast<const LteMacSduRequest>(chunk) != nullptr ) {
152158 // get the corresponding Tx buffer
153- MacCid cid = ctrlInfoToMacCid (lteInfo);
159+ MacCid cid = ctrlInfoToMacCid (lteInfo. get () );
154160 UmTxEntity *txbuf = lookupTxBuffer (cid);
155161 if (txbuf == nullptr )
156- txbuf = createTxBuffer (cid, lteInfo);
162+ txbuf = createTxBuffer (cid, lteInfo. get () );
157163
158164 auto macSduRequest = pkt->peekAtFront <LteMacSduRequest>();
159165 unsigned int size = macSduRequest->getSduSize ();
@@ -173,7 +179,7 @@ void LteRlcUm::handleLowerMessage(cPacket *pktAux)
173179 MacCid cid = MacCid (nodeId, lteInfo->getLcid ());
174180 UmRxEntity *rxbuf = lookupRxBuffer (cid);
175181 if (rxbuf == nullptr )
176- rxbuf = createRxBuffer (cid, lteInfo);
182+ rxbuf = createRxBuffer (cid, lteInfo. get () );
177183 drop (pkt);
178184
179185 // Bufferize PDU
0 commit comments