mirror of
https://github.com/RetroShare/libretroshare.git
synced 2026-09-12 19:50:03 +05:00
Merge f6c4d774ad into 2f093fd7b3
This commit is contained in:
commit
81777c0b31
@ -1075,14 +1075,33 @@ bool p3ChatService::receiveGxsTransMail( const RsGxsId& authorId,
|
||||
const uint8_t* data,
|
||||
uint32_t dataSize )
|
||||
{
|
||||
uint32_t deserialisedSize = dataSize;
|
||||
RsItem* deserialisedItem = _serializer->deserialise(
|
||||
const_cast<uint8_t*>(data), &deserialisedSize );
|
||||
RsChatMsgItem* item = dynamic_cast<RsChatMsgItem*>(deserialisedItem);
|
||||
|
||||
/*
|
||||
* GXS transport subservice P3_CHAT_SERVICE is reserved for chat messages.
|
||||
* Some development versions accidentally sent RsChatStatusItem here. Older
|
||||
* receivers then force-cast that payload to RsChatMsgItem, displaying the
|
||||
* binary status flag as a broadcast message. Such packets can remain in the
|
||||
* store-and-forward network until the GXS transport retention period ends.
|
||||
* Consume them, but never pass them to the normal chat processing path.
|
||||
*/
|
||||
if(!item)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__
|
||||
<< " (WW) dropping non-message payload received on the GXS chat subservice"
|
||||
<< std::endl;
|
||||
delete deserialisedItem;
|
||||
return true;
|
||||
}
|
||||
|
||||
DistantChatPeerId pid;
|
||||
uint32_t error_code;
|
||||
if(initiateDistantChatConnexion(
|
||||
authorId, recipientId, pid, error_code, false ))
|
||||
{
|
||||
RsChatMsgItem* item = static_cast<RsChatMsgItem*>(
|
||||
_serializer->deserialise(
|
||||
const_cast<uint8_t*>(data), &dataSize ));
|
||||
RsPeerId rd(p3GxsTunnelService::makeGxsTunnelId(authorId, recipientId));
|
||||
item->PeerId(rd);
|
||||
handleRecvChatMsgItem(item);
|
||||
@ -1090,6 +1109,8 @@ bool p3ChatService::receiveGxsTransMail( const RsGxsId& authorId,
|
||||
return true;
|
||||
}
|
||||
|
||||
delete item;
|
||||
|
||||
std::cerr << __PRETTY_FUNCTION__ << " (EE) failed initiating"
|
||||
<< " distant chat connection error: "<< error_code
|
||||
<< std::endl;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user