fixed some reputation sending bugs

This commit is contained in:
csoler 2015-10-08 23:54:18 -04:00
parent 8c6c9344fe
commit bb7a8f2732
4 changed files with 51 additions and 61 deletions

View file

@ -109,7 +109,7 @@ std::ostream& RsGxsReputationUpdateItem::print(std::ostream &out, uint16_t inden
uint16_t int_Indent = indent + 2;
out << "from: " << PeerId() << std::endl;
out << "last update: " << time(NULL) - mLatestUpdate << " secs ago." << std::endl;
//out << "last update: " << time(NULL) - mLatestUpdate << " secs ago." << std::endl;
for(std::map<RsGxsId,uint32_t>::const_iterator it(mOpinions.begin());it!=mOpinions.end();++it)
out << " " << it->first << ": " << it->second << std::endl;
@ -159,7 +159,7 @@ uint32_t RsGxsReputationUpdateItem::serial_size() const
{
uint32_t s = 8; /* header */
s += 4 ; // mLatestUpdate
//s += 4 ; // mLatestUpdate
s += 4 ; // mOpinions.size();
s += (RsGxsId::serial_size() + 4) * mOpinions.size() ;
@ -239,7 +239,7 @@ bool RsGxsReputationUpdateItem::serialise(void *data, uint32_t& pktsize) const
bool ok = true;
ok &= setRawUInt32(data, tlvsize, &offset, mLatestUpdate);
//ok &= setRawUInt32(data, tlvsize, &offset, mLatestUpdate);
ok &= setRawUInt32(data, tlvsize, &offset, mOpinions.size());
for(std::map<RsGxsId,uint32_t>::const_iterator it(mOpinions.begin());ok && it!=mOpinions.end();++it)
@ -349,7 +349,7 @@ RsGxsReputationUpdateItem *RsGxsReputationSerialiser::deserialiseReputationUpdat
RsGxsReputationUpdateItem *item = new RsGxsReputationUpdateItem() ;
/* add mandatory parts first */
ok &= getRawUInt32(data, tlvsize, &offset, &item->mLatestUpdate);
//ok &= getRawUInt32(data, tlvsize, &offset, &item->mLatestUpdate);
uint32_t S ;
ok &= getRawUInt32(data, tlvsize, &offset, &S) ;

View file

@ -105,7 +105,7 @@ public:
virtual bool serialise(void *data,uint32_t& size) const ;
virtual uint32_t serial_size() const ;
uint32_t mLatestUpdate;
//uint32_t mLatestUpdate;
std::map<RsGxsId, uint32_t> mOpinions; // GxsId -> Opinion.
};