mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
Fix Coverity issues
This commit is contained in:
parent
2656d8098c
commit
4db91a52eb
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
#include <boost/exception/all.hpp>
|
||||||
|
|
||||||
#include "FairMQChannel.h"
|
#include "FairMQChannel.h"
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
|
|
||||||
|
@ -48,79 +50,172 @@ FairMQChannel::FairMQChannel(const string& type, const string& method, const str
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FairMQChannel::GetType()
|
std::string FairMQChannel::GetType()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
return fType;
|
return fType;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string FairMQChannel::GetMethod()
|
std::string FairMQChannel::GetMethod()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
return fMethod;
|
return fMethod;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string FairMQChannel::GetAddress()
|
std::string FairMQChannel::GetAddress()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
return fAddress;
|
return fAddress;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int FairMQChannel::GetSndBufSize()
|
int FairMQChannel::GetSndBufSize()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
return fSndBufSize;
|
return fSndBufSize;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int FairMQChannel::GetRcvBufSize()
|
int FairMQChannel::GetRcvBufSize()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
return fRcvBufSize;
|
return fRcvBufSize;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int FairMQChannel::GetRateLogging()
|
int FairMQChannel::GetRateLogging()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
return fRateLogging;
|
return fRateLogging;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FairMQChannel::UpdateType(const std::string& type)
|
void FairMQChannel::UpdateType(const std::string& type)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
fType = type;
|
fType = type;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
void FairMQChannel::UpdateMethod(const std::string& method)
|
void FairMQChannel::UpdateMethod(const std::string& method)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
fMethod = method;
|
fMethod = method;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
void FairMQChannel::UpdateAddress(const std::string& address)
|
void FairMQChannel::UpdateAddress(const std::string& address)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
fAddress = address;
|
fAddress = address;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
void FairMQChannel::UpdateSndBufSize(const int sndBufSize)
|
void FairMQChannel::UpdateSndBufSize(const int sndBufSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
fSndBufSize = sndBufSize;
|
fSndBufSize = sndBufSize;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
void FairMQChannel::UpdateRcvBufSize(const int rcvBufSize)
|
void FairMQChannel::UpdateRcvBufSize(const int rcvBufSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
fRcvBufSize = rcvBufSize;
|
fRcvBufSize = rcvBufSize;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
void FairMQChannel::UpdateRateLogging(const int rateLogging)
|
void FairMQChannel::UpdateRateLogging(const int rateLogging)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
fRateLogging = rateLogging;
|
fRateLogging = rateLogging;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool FairMQChannel::IsValid()
|
bool FairMQChannel::IsValid()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
return fIsValid;
|
return fIsValid;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool FairMQChannel::ValidateChannel()
|
bool FairMQChannel::ValidateChannel()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
boost::unique_lock<boost::mutex> scoped_lock(channelMutex);
|
||||||
|
|
||||||
|
@ -183,6 +278,11 @@ bool FairMQChannel::ValidateChannel()
|
||||||
LOG(DEBUG) << ss.str();
|
LOG(DEBUG) << ss.str();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FairMQChannel::ResetChannel()
|
void FairMQChannel::ResetChannel()
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,6 +98,10 @@ bool FairMQStateMachine::ChangeState(int event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (boost::thread_interrupted& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
catch (boost::exception& e)
|
catch (boost::exception& e)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << boost::diagnostic_information(e);
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
@ -120,12 +124,19 @@ void FairMQStateMachine::WaitForEndOfState(int event)
|
||||||
case RUN:
|
case RUN:
|
||||||
case RESET_TASK:
|
case RESET_TASK:
|
||||||
case RESET_DEVICE:
|
case RESET_DEVICE:
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::mutex> lock(fStateMutex);
|
boost::unique_lock<boost::mutex> lock(fStateMutex);
|
||||||
while (!fStateFinished)
|
while (!fStateFinished)
|
||||||
{
|
{
|
||||||
fStateCondition.wait(lock);
|
fStateCondition.wait(lock);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (boost::exception& e)
|
||||||
|
{
|
||||||
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -133,7 +144,7 @@ void FairMQStateMachine::WaitForEndOfState(int event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (boost::exception &e)
|
catch (boost::thread_interrupted& e)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << boost::diagnostic_information(e);
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
}
|
}
|
||||||
|
@ -173,7 +184,7 @@ bool FairMQStateMachine::WaitForEndOfStateForMs(int event, int durationInMs)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (boost::exception &e)
|
catch (boost::thread_interrupted &e)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << boost::diagnostic_information(e);
|
LOG(ERROR) << boost::diagnostic_information(e);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user