1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Fix receiver if the System V message queue is not available (Fixes: #361)

This commit is contained in:
Carles Fernandez 2020-03-10 19:56:13 +01:00
parent 5efa2f65a4
commit f233184a31
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -63,6 +63,8 @@
#include <gnuradio/io_signature.h> // for io_signature #include <gnuradio/io_signature.h> // for io_signature
#include <pmt/pmt_sugar.h> // for mp #include <pmt/pmt_sugar.h> // for mp
#include <algorithm> // for sort, unique #include <algorithm> // for sort, unique
#include <cerrno> // for errno
#include <cstring> // for strerror
#include <exception> // for exception #include <exception> // for exception
#include <fstream> // for ofstream #include <fstream> // for ofstream
#include <iomanip> // for put_time, setprecision #include <iomanip> // for put_time, setprecision
@ -412,8 +414,8 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
int msgflg = IPC_CREAT | 0666; int msgflg = IPC_CREAT | 0666;
if ((sysv_msqid = msgget(sysv_msg_key, msgflg)) == -1) if ((sysv_msqid = msgget(sysv_msg_key, msgflg)) == -1)
{ {
std::cout << "GNSS-SDR can not create message queues!" << std::endl; std::cout << "GNSS-SDR cannot create System V message queues." << std::endl;
throw std::exception(); LOG(WARNING) << "The System V message queue is not available. Error: " << errno << " - " << strerror(errno) << std::endl;
} }
// Display time in local time zone // Display time in local time zone
@ -487,7 +489,10 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
rtklib_pvt_gs::~rtklib_pvt_gs() rtklib_pvt_gs::~rtklib_pvt_gs()
{ {
msgctl(sysv_msqid, IPC_RMID, nullptr); if (sysv_msqid != -1)
{
msgctl(sysv_msqid, IPC_RMID, nullptr);
}
try try
{ {
if (d_xml_storage) if (d_xml_storage)
@ -1678,17 +1683,21 @@ void rtklib_pvt_gs::clear_ephemeris()
bool rtklib_pvt_gs::send_sys_v_ttff_msg(ttff_msgbuf ttff) bool rtklib_pvt_gs::send_sys_v_ttff_msg(ttff_msgbuf ttff)
{ {
// Fill Sys V message structures if (sysv_msqid != -1)
int msgsend_size; {
ttff_msgbuf msg; // Fill Sys V message structures
msg.ttff = ttff.ttff; int msgsend_size;
msgsend_size = sizeof(msg.ttff); ttff_msgbuf msg;
msg.mtype = 1; // default message ID msg.ttff = ttff.ttff;
msgsend_size = sizeof(msg.ttff);
msg.mtype = 1; // default message ID
// SEND SOLUTION OVER A MESSAGE QUEUE // SEND SOLUTION OVER A MESSAGE QUEUE
// non-blocking Sys V message send // non-blocking Sys V message send
msgsnd(sysv_msqid, &msg, msgsend_size, IPC_NOWAIT); msgsnd(sysv_msqid, &msg, msgsend_size, IPC_NOWAIT);
return true; return true;
}
return false;
} }