teach nmmsender to also transmit already serialized messages

pull/135/head
bert hubert 2020-08-03 23:20:17 +02:00
parent aed36e1bf8
commit 9955463c93
2 changed files with 12 additions and 5 deletions

View File

@ -175,16 +175,22 @@ void NMMSender::sendTCPThread(Destination* d)
void NMMSender::emitNMM(const NavMonMessage& nmm)
{
string out;
nmm.SerializeToString(& out);
emitNMM(out);
}
void NMMSender::emitNMM(const std::string& out)
{
for(auto& d : d_dests) {
d->emitNMM(nmm, d_compress);
d->emitNMM(out, d_compress);
}
}
void NMMSender::Destination::emitNMM(const NavMonMessage& nmm, bool compressed)
void NMMSender::Destination::emitNMM(const std::string& out, bool compressed)
{
string out;
nmm.SerializeToString(& out);
string msg;
if(dst.empty() || !compressed)
msg="bert";

View File

@ -16,7 +16,7 @@ class NMMSender
std::deque<std::string> queue;
std::mutex mut;
void emitNMM(const NavMonMessage& nmm, bool compress);
void emitNMM(const std::string& out, bool compress);
};
public:
@ -45,6 +45,7 @@ public:
void sendTCPThread(Destination* d);
void emitNMM(const NavMonMessage& nmm);
void emitNMM(const std::string& out);
bool d_debug{false};
bool d_compress{false}; // set BEFORE launch
bool d_pleaseQuit{false};