Fix missing session name resize if running without FairMQProgOptions

This commit is contained in:
Alexey Rybalchenko 2018-01-24 12:46:04 +01:00 committed by Mohammad Al-Turany
parent efdec0f6ba
commit 2c2770204f

View File

@ -35,7 +35,7 @@ FairMQ::Transport FairMQTransportFactorySHM::fTransportType = FairMQ::Transport:
FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const FairMQProgOptions* config)
: FairMQTransportFactory(id)
, fSessionName()
, fSessionName("default")
, fContext(nullptr)
, fHeartbeatSocket(nullptr)
, fHeartbeatThread()
@ -62,8 +62,6 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
{
numIoThreads = config->GetValue<int>("io-threads");
fSessionName = config->GetValue<string>("session");
fSessionName.resize(8, '_'); // shorten the session name, to accommodate for name size limit on some systems (MacOS)
// fSegmentName = "fmq_shm_" + fSessionName + "_main";
segmentSize = config->GetValue<size_t>("shm-segment-size");
}
else
@ -71,6 +69,8 @@ FairMQTransportFactorySHM::FairMQTransportFactorySHM(const string& id, const Fai
LOG(warn) << "FairMQProgOptions not available! Using defaults.";
}
fSessionName.resize(8, '_'); // shorten the session name, to accommodate for name size limit on some systems (MacOS)
try
{
fShMutex = fair::mq::tools::make_unique<bipc::named_mutex>(bipc::open_or_create, std::string("fmq_shm_" + fSessionName + "_mutex").c_str());