WIP: somethings wrong.. #19
@ -47,7 +47,7 @@ MessageQueue::~MessageQueue() {
|
|||||||
status = mq_unlink(name);
|
status = mq_unlink(name);
|
||||||
if(status != 0){
|
if(status != 0){
|
||||||
sif::error << "MessageQueue::Destructor: mq_unlink Failed with status: "
|
sif::error << "MessageQueue::Destructor: mq_unlink Failed with status: "
|
||||||
<< strerror(errno) <<std::endl;
|
<< strerror(errno) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +149,10 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) {
|
|||||||
|
|
||||||
status = pthread_attr_setstack(&attributes, stackPointer, stackSize);
|
status = pthread_attr_setstack(&attributes, stackPointer, stackSize);
|
||||||
if(status != 0){
|
if(status != 0){
|
||||||
sif::error << "Posix Thread attribute setStack failed with: " <<
|
sif::error << "PosixThread::createTask: pthread_attr_setstack "
|
||||||
strerror(status) << std::endl;
|
" failed with: " << strerror(status) << std::endl;
|
||||||
|
sif::error << "Make sure the specified stack size is valid and is "
|
||||||
|
"larger than the minimum allowed stack size." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED);
|
status = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <framework/osal/linux/TmTcUnixUdpBridge.h>
|
#include <framework/osal/linux/TmTcUnixUdpBridge.h>
|
||||||
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
|
TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
|
||||||
object_id_t ccsdsPacketDistributor, uint16_t serverPort,
|
object_id_t ccsdsPacketDistributor, uint16_t serverPort,
|
||||||
@ -20,6 +21,7 @@ TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
|
|||||||
sif::error << "TmTcUnixUdpBridge::TmTcUnixUdpBridge: Could not open"
|
sif::error << "TmTcUnixUdpBridge::TmTcUnixUdpBridge: Could not open"
|
||||||
" UDP socket!" << std::endl;
|
" UDP socket!" << std::endl;
|
||||||
// check errno here.
|
// check errno here.
|
||||||
|
handleSocketError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,9 +41,6 @@ TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId,
|
|||||||
// check errno here.
|
// check errno here.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TmTcUnixUdpBridge::~TmTcUnixUdpBridge() {
|
TmTcUnixUdpBridge::~TmTcUnixUdpBridge() {
|
||||||
@ -58,3 +57,19 @@ ReturnValue_t TmTcUnixUdpBridge::receiveTc(uint8_t **recvBuffer, size_t *size) {
|
|||||||
ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TmTcUnixUdpBridge::handleSocketError() {
|
||||||
|
// See: https://man7.org/linux/man-pages/man2/socket.2.html
|
||||||
|
switch(errno) {
|
||||||
|
case(EACCES):
|
||||||
|
case(EINVAL):
|
||||||
|
case(EMFILE):
|
||||||
|
case(ENFILE):
|
||||||
|
case(EAFNOSUPPORT):
|
||||||
|
case(ENOBUFS):
|
||||||
|
case(ENOMEM):
|
||||||
|
case(EPROTONOSUPPORT):
|
||||||
|
sif::error << "TmTcUnixBridge::TmTcUnixBridge: Socket creation failed"
|
||||||
|
<< " with " << strerror(errno) << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -25,6 +25,8 @@ private:
|
|||||||
const int serverSocketOptions = 0;
|
const int serverSocketOptions = 0;
|
||||||
struct sockaddr_in clientAddress;
|
struct sockaddr_in clientAddress;
|
||||||
struct sockaddr_in serverAddress;
|
struct sockaddr_in serverAddress;
|
||||||
|
|
||||||
|
void handleSocketError();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user