Core/IPC: Fixed bnet & world servers getting stuck on shutdown after having communicated at any point

This commit is contained in:
Aokromes
2016-06-11 07:39:08 +02:00
parent 8ba2ae5c29
commit c689ff0e55
2 changed files with 6 additions and 2 deletions

View File

@@ -44,6 +44,7 @@ void ZMQTask::Start()
void ZMQTask::End()
{
_thread->join();
_poller->remove(*_inproc);
_inproc->close();
HandleClose();
}

View File

@@ -23,13 +23,14 @@ ZmqContext::ZmqContext() : _inproc(nullptr)
ZmqContext::~ZmqContext()
{
delete _inproc;
}
zmqpp::socket* ZmqContext::CreateNewSocket(zmqpp::socket_type type)
{
std::unique_lock<std::mutex> lock(_mutex);
return new zmqpp::socket(_context, type);
zmqpp::socket* socket = new zmqpp::socket(_context, type);
socket->set(zmqpp::socket_option::linger, 0);
return socket;
}
void ZmqContext::Initialize()
@@ -49,4 +50,6 @@ zmqpp::socket* ZmqContext::CreateInprocSubscriber()
void ZmqContext::Close()
{
_inproc->send("internalmq.kill");
delete _inproc;
_inproc = nullptr;
}