Skip to content
Snippets Groups Projects
Commit 78c6b42b authored by yanmorin's avatar yanmorin
Browse files

Sending last message before closing socket
parent 1d8be440
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,14 @@ ...@@ -19,6 +19,14 @@
#include "tcpstreampool.h" #include "tcpstreampool.h"
#include "../../global.h" #include "../../global.h"
TCPStreamPool::~TCPStreamPool()
{
terminate();
std::string output;
while (good() && _outputPool.pop(output, 2LU)) {
*this << output << std::endl;
}
}
void void
TCPStreamPool::run() { TCPStreamPool::run() {
std::string output; std::string output;
...@@ -46,8 +54,10 @@ TCPStreamPool::run() { ...@@ -46,8 +54,10 @@ TCPStreamPool::run() {
void void
TCPStreamPool::send(const std::string& response) TCPStreamPool::send(const std::string& response)
{ {
if (!testCancel()) {
_outputPool.push(response); _outputPool.push(response);
} }
}
bool bool
TCPStreamPool::receive(std::string& request) TCPStreamPool::receive(std::string& request)
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
{ {
setCancel(cancelDeferred); setCancel(cancelDeferred);
} }
TCPStreamPool::~TCPStreamPool() {terminate();} TCPStreamPool::~TCPStreamPool();
void run(); void run();
void send(const std::string& response); void send(const std::string& response);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment