mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-10 03:49:51 -05:00
added packet slicing for large broadcast chat items, and output warning when chat of serialised item is too big. Also fixed a couple of bugs in the handling of chat packets
This commit is contained in:
parent
1b5d31ff7f
commit
59aef8ab7b
@ -127,7 +127,8 @@ void p3ChatService::sendPublicChat(const std::string &msg)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (*it == ownId) {
|
if (*it == ownId)
|
||||||
|
{
|
||||||
//mHistoryMgr->addMessage(false, RsPeerId(), ownId, ci);
|
//mHistoryMgr->addMessage(false, RsPeerId(), ownId, ci);
|
||||||
ChatMessage message;
|
ChatMessage message;
|
||||||
initChatMessage(ci, message);
|
initChatMessage(ci, message);
|
||||||
@ -136,7 +137,8 @@ void p3ChatService::sendPublicChat(const std::string &msg)
|
|||||||
RsServer::notify()->notifyChatMessage(message);
|
RsServer::notify()->notifyChatMessage(message);
|
||||||
mHistoryMgr->addMessage(message);
|
mHistoryMgr->addMessage(message);
|
||||||
}
|
}
|
||||||
sendItem(ci);
|
else
|
||||||
|
checkSizeAndSendMessage(ci);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,10 +569,10 @@ uint32_t p3ChatService::getMaxMessageSecuritySize(int type)
|
|||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case RS_CHAT_TYPE_PUBLIC:
|
|
||||||
case RS_CHAT_TYPE_LOBBY:
|
case RS_CHAT_TYPE_LOBBY:
|
||||||
return MAX_MESSAGE_SECURITY_SIZE;
|
return MAX_MESSAGE_SECURITY_SIZE;
|
||||||
|
|
||||||
|
case RS_CHAT_TYPE_PUBLIC:
|
||||||
case RS_CHAT_TYPE_PRIVATE:
|
case RS_CHAT_TYPE_PRIVATE:
|
||||||
case RS_CHAT_TYPE_DISTANT:
|
case RS_CHAT_TYPE_DISTANT:
|
||||||
return 0; // unlimited
|
return 0; // unlimited
|
||||||
|
@ -58,7 +58,10 @@ bool RsServiceSerialiser::serialise(RsItem *i, void *data, uint32_t *pktsize)
|
|||||||
return false; /* not enough space */
|
return false; /* not enough space */
|
||||||
|
|
||||||
if (tlvsize > getRsPktMaxSize())
|
if (tlvsize > getRsPktMaxSize())
|
||||||
|
{
|
||||||
|
std::cerr << "(EE) Serialised packet is too big. Maximum allowed size is " << getRsPktMaxSize() << ". Serialised size is " << tlvsize << ". Please tune your service to correctly split packets" << std::endl;
|
||||||
return false; /* packet too big */
|
return false; /* packet too big */
|
||||||
|
}
|
||||||
|
|
||||||
*pktsize = tlvsize;
|
*pktsize = tlvsize;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user