diff --git a/src/gui/server/tcpstreampool.cpp b/src/gui/server/tcpstreampool.cpp index e66ae2b4cb903859ffdff6d45b4a33124f56f01f..353914da0203ac0d448c2363215f946863c74bd7 100644 --- a/src/gui/server/tcpstreampool.cpp +++ b/src/gui/server/tcpstreampool.cpp @@ -19,6 +19,14 @@ #include "tcpstreampool.h" #include "../../global.h" +TCPStreamPool::~TCPStreamPool() +{ + terminate(); + std::string output; + while (good() && _outputPool.pop(output, 2LU)) { + *this << output << std::endl; + } +} void TCPStreamPool::run() { std::string output; @@ -46,7 +54,9 @@ TCPStreamPool::run() { void TCPStreamPool::send(const std::string& response) { - _outputPool.push(response); + if (!testCancel()) { + _outputPool.push(response); + } } bool diff --git a/src/gui/server/tcpstreampool.h b/src/gui/server/tcpstreampool.h index 6bec3bd783f1fec6ae55c9071bbace7356084457..3c7420ee0f8b008988b117fd5b3b701991d0b8c8 100644 --- a/src/gui/server/tcpstreampool.h +++ b/src/gui/server/tcpstreampool.h @@ -43,7 +43,7 @@ public: { setCancel(cancelDeferred); } - TCPStreamPool::~TCPStreamPool() {terminate();} + TCPStreamPool::~TCPStreamPool(); void run(); void send(const std::string& response);