mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fix the serial of rsdisc
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1904 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c06d0c6f98
commit
4f20a4d89c
@ -146,6 +146,7 @@ void RsDiscOwnItem::clear()
|
||||
memset(&saddr, 0, sizeof(laddr));
|
||||
contact_tf = 0;
|
||||
discFlags = 0;
|
||||
ipAddressList.clear();
|
||||
}
|
||||
|
||||
std::ostream &RsDiscOwnItem::print(std::ostream &out, uint16_t indent)
|
||||
@ -168,6 +169,16 @@ std::ostream &RsDiscOwnItem::print(std::ostream &out, uint16_t indent)
|
||||
printIndent(out, int_Indent);
|
||||
out << "DiscFlags: " << discFlags << std::endl;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "IpAddressListSize: " << ipAddressList.size() << std::endl;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "RsDiscOwnItem::print() IpAddressList: " << std::endl;
|
||||
for (std::list<IpAddressTimed>::iterator ipListIt = ipAddressList.begin(); ipListIt!=(ipAddressList.end()); ipListIt++) {
|
||||
printIndent(out, int_Indent);
|
||||
out << inet_ntoa(ipListIt->ipAddr.sin_addr) << ":" << ntohs(ipListIt->ipAddr.sin_port) << " seenTime : " << ipListIt->seenTime << std::endl;
|
||||
}
|
||||
|
||||
printRsItemEnd(out, "RsDiscOwnItem", indent);
|
||||
return out;
|
||||
}
|
||||
@ -210,7 +221,7 @@ bool RsDiscSerialiser::serialiseItem(RsDiscOwnItem *item, void *data, uint32
|
||||
std::cerr << "RsDiscSerialiser::serialiseItem() Size: " << tlvsize << std::endl;
|
||||
#endif
|
||||
|
||||
/* skip the header */
|
||||
/* skip the header */
|
||||
offset += 8;
|
||||
|
||||
/* add mandatory parts first */
|
||||
@ -292,9 +303,9 @@ RsDiscOwnItem *RsDiscSerialiser::deserialiseOwnItem(void *data, uint32_t *pktsiz
|
||||
ok &= getRawUInt32(data, rssize, &offset, &listSize);
|
||||
|
||||
//get the ip adress list
|
||||
uint32_t count = 0;
|
||||
int count = 0;
|
||||
std::list<IpAddressTimed> ipTimedList;
|
||||
while (offset < rssize && count < listSize) {
|
||||
while (offset < rssize && count < (int)listSize) {
|
||||
count++;
|
||||
IpAddressTimed ipTimed;
|
||||
ok &= GetTlvIpAddrPortV4(data, rssize, &offset, TLV_TYPE_IPV4_REMOTE, &ipTimed.ipAddr);
|
||||
@ -344,6 +355,7 @@ void RsDiscReply::clear()
|
||||
discFlags = 0;
|
||||
aboutId.clear();
|
||||
certDER.TlvClear();
|
||||
ipAddressList.clear();
|
||||
}
|
||||
|
||||
std::ostream &RsDiscReply::print(std::ostream &out, uint16_t indent)
|
||||
@ -366,6 +378,16 @@ std::ostream &RsDiscReply::print(std::ostream &out, uint16_t indent)
|
||||
printIndent(out, int_Indent);
|
||||
out << "DiscFlags: " << discFlags << std::endl;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "IpAddressListSize: " << ipAddressList.size() << std::endl;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "RsDiscOwnItem::print() IpAddressList: " << std::endl;
|
||||
for (std::list<IpAddressTimed>::iterator ipListIt = ipAddressList.begin(); ipListIt!=(ipAddressList.end()); ipListIt++) {
|
||||
printIndent(out, int_Indent);
|
||||
out << inet_ntoa(ipListIt->ipAddr.sin_addr) << ":" << ntohs(ipListIt->ipAddr.sin_port) << " seenTime : " << ipListIt->seenTime << std::endl;
|
||||
}
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "AboutId: " << aboutId << std::endl;
|
||||
certDER.print(out, int_Indent);
|
||||
@ -502,9 +524,10 @@ RsDiscReply *RsDiscSerialiser::deserialiseReply(void *data, uint32_t *pktsize)
|
||||
ok &= getRawUInt32(data, rssize, &offset, &listSize);
|
||||
|
||||
//get the ip adress list
|
||||
uint32_t count = 0;
|
||||
int count = 0;
|
||||
std::list<IpAddressTimed> ipTimedList;
|
||||
while (offset < rssize && count < listSize) {
|
||||
while (offset < rssize && count < (int)listSize) {
|
||||
count++;
|
||||
IpAddressTimed ipTimed;
|
||||
ok &= GetTlvIpAddrPortV4(data, rssize, &offset, TLV_TYPE_IPV4_REMOTE, &ipTimed.ipAddr);
|
||||
uint64_t time;
|
||||
|
Loading…
Reference in New Issue
Block a user