From da1448658a59b2ce60be1f2589a0ccc2f4d53f9c Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Fri, 3 May 2024 09:13:47 +0300 Subject: [PATCH] kio: suspend slaves to prevent data going in or out that design flaw needs a proper fix but it will not happen until I rewrite everything job-related Signed-off-by: Ivailo Monev --- kio/kio/slaveinterface.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kio/kio/slaveinterface.cpp b/kio/kio/slaveinterface.cpp index e8c81be8..7c3aaa03 100644 --- a/kio/kio/slaveinterface.cpp +++ b/kio/kio/slaveinterface.cpp @@ -131,10 +131,20 @@ bool SlaveInterface::isAlive() const void SlaveInterface::suspend() { m_connection->suspend(); + // TODO: this is not a proper way to suspend slaves (tho it works), e.g. for remote connections + // a server may decide to just close the connection because there is no reponse from the slave + // for some time but otherwise data keeps getting pumped in or out. for example it works for + // file slave but not for the curl slave + if (m_pid) { + ::kill(m_pid, SIGSTOP); + } } void SlaveInterface::resume() { + if (m_pid) { + ::kill(m_pid, SIGCONT); + } m_connection->resume(); }