linux fixes

This commit is contained in:
Robin Müller 2020-06-24 01:11:48 +02:00
parent af24cc7d04
commit 16cbbb2693
3 changed files with 7 additions and 17 deletions

View File

@ -281,8 +281,7 @@ ReturnValue_t MessageQueue::sendToDefaultFrom(MessageQueueMessageIF* message,
ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo,
MessageQueueMessageIF* message, MessageQueueId_t sentFrom, MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
bool ignoreFault) { bool ignoreFault) {
return sendMessageFromMessageQueue(sendTo,message, maxMessageSize, return sendMessageFromMessageQueue(sendTo,message, sentFrom,ignoreFault);
sentFrom,ignoreFault);
} }
@ -297,22 +296,14 @@ bool MessageQueue::isDefaultDestinationSet() const {
uint16_t MessageQueue::queueCounter = 0; uint16_t MessageQueue::queueCounter = 0;
ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
MessageQueueMessageIF *message, size_t maxSize, MessageQueueMessageIF *message, MessageQueueId_t sentFrom,
MessageQueueId_t sentFrom, bool ignoreFault) { bool ignoreFault) {
if(message == nullptr) { if(message == nullptr) {
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is " sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is "
"nullptr!" << std::endl; "nullptr!" << std::endl;
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
if(message->getMaximumMessageSize() > maxSize) {
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size "
<< message->getMaximumMessageSize() << " too large for queue"
" with max. message size " << maxSize << "!"
<< std::endl;
return HasReturnvaluesIF::RETURN_FAILED;
}
message->setSender(sentFrom); message->setSender(sentFrom);
int result = mq_send(sendTo, int result = mq_send(sendTo,
reinterpret_cast<const char*>(message->getBuffer()), reinterpret_cast<const char*>(message->getBuffer()),

View File

@ -149,8 +149,7 @@ protected:
* \param ignoreFault If set to true, the internal software fault counter is not incremented if queue is full. * \param ignoreFault If set to true, the internal software fault counter is not incremented if queue is full.
*/ */
static ReturnValue_t sendMessageFromMessageQueue(MessageQueueId_t sendTo, static ReturnValue_t sendMessageFromMessageQueue(MessageQueueId_t sendTo,
MessageQueueMessageIF* message, size_t maxSize, MessageQueueMessageIF* message, MessageQueueId_t sentFrom = NO_QUEUE,
MessageQueueId_t sentFrom = NO_QUEUE,
bool ignoreFault=false); bool ignoreFault=false);
private: private:
/** /**

View File

@ -9,10 +9,10 @@ QueueFactory* QueueFactory::factoryInstance = nullptr;
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo, ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
MessageQueueMessageIF* message, size_t maxSize, MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
MessageQueueId_t sentFrom, bool ignoreFault) { bool ignoreFault) {
return MessageQueue::sendMessageFromMessageQueue(sendTo,message, return MessageQueue::sendMessageFromMessageQueue(sendTo,message,
maxSize, sentFrom,ignoreFault); sentFrom,ignoreFault);
} }
QueueFactory* QueueFactory::instance() { QueueFactory* QueueFactory::instance() {