Partially revert bea6769a4e.

Currently the log is flooded with messages about "unkown" packets which are actually just deprecated ones. Add back the code to gracefully handle them (= delete them).
This commit is contained in:
sehraf 2020-04-18 11:42:12 +02:00
parent 27bbd50f1f
commit f19d933ff1
No known key found for this signature in database
GPG Key ID: DF09F6EAE356B2C6
3 changed files with 26 additions and 0 deletions

View File

@ -37,6 +37,7 @@ RsItem *RsDiscSerialiser::create_item(
{
case RsGossipDiscoveryItemType::PGP_LIST: return new RsDiscPgpListItem();
case RsGossipDiscoveryItemType::PGP_CERT_BINARY: return new RsDiscPgpKeyItem();
case RsGossipDiscoveryItemType::PGP_CERT: return new RsDiscPgpCertItem(); // deprecated, hanlde to suppress "unkown item" warning
case RsGossipDiscoveryItemType::CONTACT: return new RsDiscContactItem();
case RsGossipDiscoveryItemType::IDENTITY_LIST: return new RsDiscIdentityListItem();
default:

View File

@ -97,6 +97,27 @@ public:
uint32_t bin_len;
};
class RS_DEPRECATED_FOR(RsDiscPgpKeyItem) RsDiscPgpCertItem: public RsDiscItem
{
public:
RsDiscPgpCertItem() : RsDiscItem(RsGossipDiscoveryItemType::PGP_CERT)
{ setPriorityLevel(QOS_PRIORITY_RS_DISC_PGP_CERT); }
void clear() override
{
pgpId.clear();
pgpCert.clear();
}
void serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx) override
{
RsTypeSerializer::serial_process(j,ctx,pgpId,"pgpId") ;
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_PGPCERT,pgpCert,"pgpCert") ;
}
RsPgpId pgpId;
std::string pgpCert;
};
class RsDiscContactItem: public RsDiscItem
{
public:

View File

@ -260,6 +260,7 @@ int p3discovery2::handleIncoming()
{
RsDiscPgpListItem* pgplist = nullptr;
RsDiscPgpKeyItem* pgpkey = nullptr;
RsDiscPgpCertItem* pgpcert = nullptr; // deprecated, hanlde for retro compability
RsDiscContactItem* contact = nullptr;
RsDiscIdentityListItem* gxsidlst = nullptr;
@ -282,6 +283,9 @@ int p3discovery2::handleIncoming()
}
else if((pgpkey = dynamic_cast<RsDiscPgpKeyItem *>(item)) != nullptr)
recvPGPCertificate(item->PeerId(), pgpkey);
else if((pgpcert = dynamic_cast<RsDiscPgpCertItem *>(item)) != nullptr)
// sink
delete pgpcert;
else if((pgplist = dynamic_cast<RsDiscPgpListItem *>(item)) != nullptr)
{
if (pgplist->mode == RsGossipDiscoveryPgpListMode::FRIENDS)