Fix more warnings in message service

This commit is contained in:
Gioacchino Mazzurco 2019-10-26 14:50:16 +02:00
parent 45b623b2ce
commit e530616c53
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051

View File

@ -56,19 +56,10 @@
#include <map> #include <map>
#include <sstream> #include <sstream>
//#define MSG_DEBUG 1
//#define DEBUG_DISTANT_MSG
//#define DISABLE_DISTANT_MESSAGES
//#define DEBUG_DISTANT_MSG
typedef unsigned int uint;
using namespace Rs::Msgs; using namespace Rs::Msgs;
static struct RsLog::logInfo msgservicezoneInfo = {RsLog::Default, "msgservice"}; /// keep msg hashes for 2 months to avoid re-sent msgs
#define msgservicezone &msgservicezoneInfo static constexpr uint32_t RS_MSG_DISTANT_MESSAGE_HASH_KEEP_TIME = 2*30*86400;
static const uint32_t RS_MSG_DISTANT_MESSAGE_HASH_KEEP_TIME = 2*30*86400 ; // keep msg hashes for 2 months to avoid re-sent msgs
/* Another little hack ..... unique message Ids /* Another little hack ..... unique message Ids
* will be handled in this class..... * will be handled in this class.....
@ -129,11 +120,8 @@ uint32_t p3MsgService::getNewUniqueMsgId()
return mMsgUniqueId++; return mMsgUniqueId++;
} }
int p3MsgService::tick() int p3MsgService::tick()
{ {
pqioutput(PQL_DEBUG_BASIC, msgservicezone,
"p3MsgService::tick()");
/* don't worry about increasing tick rate! /* don't worry about increasing tick rate!
* (handled by p3service) * (handled by p3service)
*/ */
@ -390,9 +378,8 @@ int p3MsgService::checkOutgoingMessages()
if(should_send) if(should_send)
{ {
/* send msg */ Dbg3() << __PRETTY_FUNCTION__ << " Sending out message"
pqioutput( PQL_DEBUG_BASIC, msgservicezone, << std::endl;
"p3MsgService::checkOutGoingMessages() Sending out message");
/* remove the pending flag */ /* remove the pending flag */
output_queue.push_back(mit->second); output_queue.push_back(mit->second);
@ -419,8 +406,8 @@ int p3MsgService::checkOutgoingMessages()
} }
else else
{ {
pqioutput( PQL_DEBUG_BASIC, msgservicezone, Dbg3() << __PRETTY_FUNCTION__ << " Delaying until available..."
"p3MsgService::checkOutGoingMessages() Delaying until available..."); << std::endl;
} }
} }
@ -1111,12 +1098,14 @@ bool p3MsgService::setMsgParentId(uint32_t msgId, uint32_t msgParentId)
/****************************************/ /****************************************/
/****************************************/ /****************************************/
/* Message Items */ /* Message Items */
uint32_t p3MsgService::sendMessage(RsMsgItem *item) // no from field because it's implicitly our own PeerId // no from field because it's implicitly our own PeerId
uint32_t p3MsgService::sendMessage(RsMsgItem* item)
{ {
if(!item) if(!item)
return 0 ; {
RsErr() << __PRETTY_FUNCTION__ << " item can't be null" << std::endl;
pqioutput(PQL_DEBUG_BASIC, msgservicezone, "p3MsgService::sendMessage()"); return 0;
}
item->msgId = getNewUniqueMsgId(); /* grabs Mtx as well */ item->msgId = getNewUniqueMsgId(); /* grabs Mtx as well */
item->msgFlags |= (RS_MSG_FLAGS_OUTGOING | RS_MSG_FLAGS_PENDING); /* add pending flag */ item->msgFlags |= (RS_MSG_FLAGS_OUTGOING | RS_MSG_FLAGS_PENDING); /* add pending flag */