Skip to content

Commit

Permalink
DEVOPS-10175 windows connection loop stopvar
Browse files Browse the repository at this point in the history
  • Loading branch information
ipalenov committed Jun 5, 2024
1 parent 9fa084e commit fd61e0a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/windows/ConnectionImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ ConnectionImpl::ConnectionImpl(const AMQP::Address& address) :
ConnectionImpl::~ConnectionImpl() {
closeChannel(trChannel);
closeChannel(rcChannel);
if (connection->usable()) {
connection->close();
}
handler.stopLoop();
thread.join();
connection.reset(nullptr);
}
Expand Down
5 changes: 2 additions & 3 deletions src/windows/SimplePocoHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ SimplePocoHandler::~SimplePocoHandler()
close();
}

void SimplePocoHandler::setConnection(AMQP::Connection* connection)
void SimplePocoHandler::setConnection(AMQP::Connection* connection): stop(false)
{
m_impl->connection = connection;
}
Expand All @@ -136,8 +136,7 @@ void SimplePocoHandler::loopThread(SimplePocoHandler* obj)

void SimplePocoHandler::loopRead()
{

while (m_impl->connection->usable())
while (!stop)
{
try
{
Expand Down
2 changes: 2 additions & 0 deletions src/windows/SimplePocoHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SimplePocoHandler: public AMQP::ConnectionHandler

void setConnection(AMQP::Connection* connection);
void loopRead();
inline void stopLoop() {stop=true;}
static void loopThread(SimplePocoHandler* clazz);
void loopIteration();
inline const std::string& getError(){ return error;}
Expand All @@ -43,6 +44,7 @@ class SimplePocoHandler: public AMQP::ConnectionHandler

std::shared_ptr<SimplePocoHandlerImpl> m_impl;
std::string error;
volatile bool stop;

};

Expand Down

0 comments on commit fd61e0a

Please sign in to comment.