applications, internet-apps: Avoid error-prone pattern for streams assignments

Reported by Sharan Naribole
This commit is contained in:
Sébastien Deronne
2024-06-12 08:04:35 +02:00
parent c78450ca8b
commit 68cfcec086
4 changed files with 21 additions and 19 deletions

View File

@@ -134,9 +134,10 @@ int64_t
OnOffApplication::AssignStreams(int64_t stream)
{
NS_LOG_FUNCTION(this << stream);
m_onTime->SetStream(stream);
m_offTime->SetStream(stream + 1);
return 2;
auto currentStream = stream;
m_onTime->SetStream(currentStream++);
m_offTime->SetStream(currentStream++);
return (currentStream - stream);
}
void

View File

@@ -298,18 +298,17 @@ int64_t
ThreeGppHttpVariables::AssignStreams(int64_t stream)
{
NS_LOG_FUNCTION(this << stream);
m_mtuSizeRng->SetStream(stream);
m_requestSizeRng->SetStream(stream + 1);
m_mainObjectGenerationDelayRng->SetStream(stream + 2);
m_mainObjectSizeRng->SetStream(stream + 3);
m_embeddedObjectGenerationDelayRng->SetStream(stream + 4);
m_embeddedObjectSizeRng->SetStream(stream + 5);
m_numOfEmbeddedObjectsRng->SetStream(stream + 6);
m_readingTimeRng->SetStream(stream + 7);
m_parsingTimeRng->SetStream(stream + 8);
return 9;
auto currentStream = stream;
m_mtuSizeRng->SetStream(currentStream++);
m_requestSizeRng->SetStream(currentStream++);
m_mainObjectGenerationDelayRng->SetStream(currentStream++);
m_mainObjectSizeRng->SetStream(currentStream++);
m_embeddedObjectGenerationDelayRng->SetStream(currentStream++);
m_embeddedObjectSizeRng->SetStream(currentStream++);
m_numOfEmbeddedObjectsRng->SetStream(currentStream++);
m_readingTimeRng->SetStream(currentStream++);
m_parsingTimeRng->SetStream(currentStream++);
return (currentStream - stream);
}
void

View File

@@ -145,8 +145,9 @@ int64_t
DhcpClient::AssignStreams(int64_t stream)
{
NS_LOG_FUNCTION(this << stream);
m_ran->SetStream(stream);
return 1;
auto currentStream = stream;
m_ran->SetStream(currentStream++);
return (currentStream - stream);
}
void

View File

@@ -172,8 +172,9 @@ int64_t
Radvd::AssignStreams(int64_t stream)
{
NS_LOG_FUNCTION(this << stream);
m_jitter->SetStream(stream);
return 1;
auto currentStream = stream;
m_jitter->SetStream(currentStream++);
return (currentStream - stream);
}
void