mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 18:11:49 +00:00
refactor to more idiomatic RAII
* FairMQTransportFactoryZMQ: move the config invariant initialization to ctor * FairMQChannel: add new ctor that creates usable channel * FairMQSocket*: close sockets in dtor * FairMQTransportFactory*: terminate context in dtor * FairMQChannel: add Bind/Connect facades (for explicit control, e.g. timing)
This commit is contained in:
committed by
Mohammad Al-Turany
parent
87252edbe0
commit
3205e0c378
@@ -1235,45 +1235,7 @@ void FairMQDevice::Exit()
|
||||
t.second->Shutdown();
|
||||
}
|
||||
|
||||
LOG(DEBUG) << "Closing sockets...";
|
||||
|
||||
// iterate over the channels
|
||||
for (auto& c : fChannels)
|
||||
{
|
||||
// iterate over the sub-channels
|
||||
for (auto& sc : c.second)
|
||||
{
|
||||
if (sc.fSocket)
|
||||
{
|
||||
sc.fSocket->Close();
|
||||
sc.fSocket = nullptr;
|
||||
}
|
||||
if (sc.fChannelCmdSocket)
|
||||
{
|
||||
sc.fChannelCmdSocket->Close();
|
||||
sc.fChannelCmdSocket = nullptr;
|
||||
}
|
||||
if (sc.fPoller)
|
||||
{
|
||||
sc.fPoller = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& s : fDeviceCmdSockets)
|
||||
{
|
||||
s.second->Close();
|
||||
}
|
||||
|
||||
LOG(DEBUG) << "Closed all sockets!";
|
||||
|
||||
// ask transports to terminate
|
||||
for (const auto& t : fTransports)
|
||||
{
|
||||
t.second->Terminate();
|
||||
}
|
||||
|
||||
LOG(DEBUG) << "All transports exited.";
|
||||
LOG(DEBUG) << "All transports are shut down.";
|
||||
}
|
||||
|
||||
FairMQDevice::~FairMQDevice()
|
||||
|
Reference in New Issue
Block a user