Revert "gui: verify agent directory before starting statewait/chat streams"
This reverts commit dbbcc07934.
This commit is contained in:
parent
dbbcc07934
commit
9f51a2181b
|
|
@ -437,19 +437,13 @@ void Ollie9pClient::ensureRootDataLoaded()
|
|||
|
||||
void Ollie9pClient::startChatStream()
|
||||
{
|
||||
if (m_chatProc) return;
|
||||
if (m_activeSessionId.isEmpty() || m_agentId.isEmpty()) return;
|
||||
|
||||
// Verify the agent directory exists before opening a blocking read
|
||||
QString ap = agentPath();
|
||||
QByteArray verify = run9p({"stat", ap});
|
||||
if (verify.isEmpty()) return; // directory gone
|
||||
|
||||
m_chatProc = new QProcess(this);
|
||||
connect(m_chatProc, &QProcess::readyReadStandardOutput, this, &Ollie9pClient::onChatReadyRead);
|
||||
connect(m_chatProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, &Ollie9pClient::onChatFinished);
|
||||
m_chatProc->start(ninepBin(), {"-a", serverAddr(), "read", ap + "/chat"});
|
||||
if (m_chatProc) return;
|
||||
if (m_activeSessionId.isEmpty() || m_agentId.isEmpty()) return;
|
||||
m_chatProc = new QProcess(this);
|
||||
connect(m_chatProc, &QProcess::readyReadStandardOutput, this, &Ollie9pClient::onChatReadyRead);
|
||||
connect(m_chatProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, &Ollie9pClient::onChatFinished);
|
||||
m_chatProc->start(ninepBin(), {"-a", serverAddr(), "read", agentPath() + "/chat"});
|
||||
}
|
||||
|
||||
void Ollie9pClient::startStateStream()
|
||||
|
|
@ -459,16 +453,6 @@ void Ollie9pClient::startStateStream()
|
|||
// Check if session still exists before starting
|
||||
if (m_activeSessionId.isEmpty() || m_agentId.isEmpty()) return;
|
||||
|
||||
// Verify the agent directory still exists before opening a blocking read
|
||||
QString ap = agentPath();
|
||||
QByteArray verify = run9p({"stat", ap});
|
||||
if (verify.isEmpty()) {
|
||||
// Directory gone — don't start spamming
|
||||
m_agentId.clear();
|
||||
emit activeAgentIdChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify the current agent directory still exists
|
||||
QStringList agents = getAgents(m_activeSessionId);
|
||||
if (agents.isEmpty()) {
|
||||
|
|
@ -481,11 +465,11 @@ void Ollie9pClient::startStateStream()
|
|||
emit activeAgentIdChanged();
|
||||
}
|
||||
|
||||
m_stateProc = new QProcess(this);
|
||||
connect(m_stateProc, &QProcess::readyReadStandardOutput, this, &Ollie9pClient::onStateReadyRead);
|
||||
connect(m_stateProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, &Ollie9pClient::onStateFinished);
|
||||
m_stateProc->start(ninepBin(), {"-a", serverAddr(), "read", ap + "/statewait"});
|
||||
m_stateProc = new QProcess(this);
|
||||
connect(m_stateProc, &QProcess::readyReadStandardOutput, this, &Ollie9pClient::onStateReadyRead);
|
||||
connect(m_stateProc, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||
this, &Ollie9pClient::onStateFinished);
|
||||
m_stateProc->start(ninepBin(), {"-a", serverAddr(), "read", agentPath() + "/statewait"});
|
||||
}
|
||||
|
||||
void Ollie9pClient::stopStreams()
|
||||
|
|
@ -545,9 +529,8 @@ void Ollie9pClient::onStateFinished(int, QProcess::ExitStatus)
|
|||
{
|
||||
m_stateProc->deleteLater();
|
||||
m_stateProc = nullptr;
|
||||
// Restart to pick up the next state change — statewait is a blocking
|
||||
// read that returns once and closes the FD.
|
||||
startStateStream();
|
||||
// Do NOT restart — statewait is only started when the user
|
||||
// explicitly selects an agent via setActiveSessionId or switchAgent.
|
||||
}
|
||||
|
||||
void Ollie9pClient::startEventStream()
|
||||
|
|
|
|||
Reference in New Issue