mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
Read command header in interpretCommand()
p4#: 21756
This commit is contained in:
parent
cdb7343129
commit
389247c17e
@ -414,6 +414,19 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we have not read the header and there are data enough: Read it.
|
||||
// Do nothing if we have not enough data
|
||||
|
||||
if (m_timeStepCountToRead == 0 || m_bytesPerTimeStepToRead == 0)
|
||||
{
|
||||
if (server->currentClient()->bytesAvailable() < (int)sizeof(quint64)*2) return true;
|
||||
|
||||
socketStream >> m_timeStepCountToRead;
|
||||
socketStream >> m_bytesPerTimeStepToRead;
|
||||
}
|
||||
|
||||
// std::cout << "RiaSetActiveCellProperty: " << propertyName.data() << " timeStepCount " << m_timeStepCountToRead << " bytesPerTimeStep " << m_bytesPerTimeStepToRead;
|
||||
|
||||
// Create a list of all the requested timesteps
|
||||
|
||||
m_requestedTimesteps.clear();
|
||||
@ -421,7 +434,7 @@ public:
|
||||
if (args.size() <= 4)
|
||||
{
|
||||
// Select all
|
||||
for (size_t tsIdx = 0; tsIdx < scalarResultFrames->size(); ++tsIdx)
|
||||
for (size_t tsIdx = 0; tsIdx < m_timeStepCountToRead; ++tsIdx)
|
||||
{
|
||||
m_requestedTimesteps.push_back(tsIdx);
|
||||
}
|
||||
@ -482,6 +495,8 @@ public:
|
||||
|
||||
virtual bool interpretMore(RiaSocketServer* server, QTcpSocket* currentClient)
|
||||
{
|
||||
// std::cout << "RiaSetActiveCellProperty, interpretMore: scalarIndex : " << m_currentScalarIndex;
|
||||
|
||||
if (m_invalidActiveCellCountDetected) return true;
|
||||
|
||||
if (!currentClient->bytesAvailable()) return false;
|
||||
@ -489,17 +504,6 @@ public:
|
||||
QDataStream socketStream(currentClient);
|
||||
socketStream.setVersion(riOctavePlugin::qtDataStreamVersion);
|
||||
|
||||
// If we have not read the header and there are data enough: Read it.
|
||||
// Do nothing if we have not enough data
|
||||
|
||||
if (m_timeStepCountToRead == 0 || m_bytesPerTimeStepToRead == 0)
|
||||
{
|
||||
if (currentClient->bytesAvailable() < (int)sizeof(quint64)*2) return false;
|
||||
|
||||
socketStream >> m_timeStepCountToRead;
|
||||
socketStream >> m_bytesPerTimeStepToRead;
|
||||
}
|
||||
|
||||
if (m_timeStepCountToRead != m_requestedTimesteps.size())
|
||||
{
|
||||
CVF_ASSERT(false);
|
||||
@ -597,6 +601,10 @@ public:
|
||||
++m_currentTimeStepNumberToRead;
|
||||
}
|
||||
|
||||
// std::cout << "RiaSetActiveCellProperty, completed " << std::endl;
|
||||
// currentClient->disconnect();
|
||||
// std::cout << "RiaSetActiveCellProperty, completed (after disconnect) " << std::endl;
|
||||
|
||||
// If we have read all the data, refresh the views
|
||||
|
||||
if (m_currentTimeStepNumberToRead == m_timeStepCountToRead)
|
||||
@ -638,6 +646,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
// std::cout << "RiaSetActiveCellProperty, completed : scalarIndex : " << m_currentScalarIndex;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user