Commit e5fdd868 authored by aligungr's avatar aligungr

SM context refactor

parent 89825f99
......@@ -25,7 +25,7 @@ int NasSm::allocatePduSessionId(const SessionConfig &config)
int id = -1;
for (int i = PduSession::MIN_ID; i <= PduSession::MAX_ID; i++)
{
if (arr[i].id == 0)
if (arr[i]->psState == EPsState::INACTIVE)
{
id = i;
break;
......@@ -38,13 +38,6 @@ int NasSm::allocatePduSessionId(const SessionConfig &config)
return 0;
}
arr[id] = {};
arr[id].id = id;
arr[id].isEstablished = false;
arr[id].apn = config.apn;
arr[id].sessionType = config.type;
arr[id].sNssai = config.sNssai;
return id;
}
......@@ -55,7 +48,7 @@ int NasSm::allocateProcedureTransactionId()
int id = -1;
for (int i = ProcedureTransaction::MIN_ID; i <= ProcedureTransaction::MAX_ID; i++)
{
if (arr[i].id == 0)
if (!arr[i].isUsed)
{
id = i;
break;
......@@ -69,7 +62,6 @@ int NasSm::allocateProcedureTransactionId()
}
arr[id] = {};
arr[id].id = id;
return id;
}
......@@ -81,7 +73,7 @@ void NasSm::freeProcedureTransactionId(int pti)
void NasSm::freePduSessionId(int psi)
{
m_pduSessions[psi] = {};
m_pduSessions[psi]->psState = EPsState::INACTIVE;
}
} // namespace nr::ue
\ No newline at end of file
......@@ -14,6 +14,9 @@ namespace nr::ue
NasSm::NasSm(TaskBase *base, UeTimers *timers) : m_base(base), m_timers(timers), m_mm(nullptr)
{
m_logger = base->logBase->makeUniqueLogger(base->config->getLoggerPrefix() + "nas");
for (int i = 0; i < 16; i++)
m_pduSessions[i] = new PduSession(i);
}
void NasSm::onStart(NasMm *mm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment