File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ bool operator==(const CNetAddr& a, const CNetAddr& b)
318318
319319bool operator !=(const CNetAddr& a, const CNetAddr& b)
320320{
321- return (memcmp (a.ip , b.ip , 16 ) != 0 );
321+ return a. m_net != b. m_net || (memcmp (a.ip , b.ip , 16 ) != 0 );
322322}
323323
324324bool operator <(const CNetAddr& a, const CNetAddr& b)
@@ -334,8 +334,21 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const
334334 return true ;
335335}
336336
337+ /* *
338+ * Try to get our IPv6 address.
339+ *
340+ * @param[out] pipv6Addr The in6_addr struct to which to copy.
341+ *
342+ * @returns Whether or not the operation was successful, in particular, whether
343+ * or not our address was an IPv6 address.
344+ *
345+ * @see CNetAddr::IsIPv6()
346+ */
337347bool CNetAddr::GetIn6Addr (struct in6_addr * pipv6Addr) const
338348{
349+ if (!IsIPv6 ()) {
350+ return false ;
351+ }
339352 memcpy (pipv6Addr, ip, 16 );
340353 return true ;
341354}
Original file line number Diff line number Diff line change @@ -223,7 +223,11 @@ class CService : public CNetAddr
223223 CService (const struct in6_addr & ipv6Addr, uint16_t port);
224224 CService (const struct sockaddr_in6 & addr);
225225
226- SERIALIZE_METHODS (CService, obj) { READWRITE (obj.ip , Using<BigEndianFormatter<2 >>(obj.port )); }
226+ SERIALIZE_METHODS (CService, obj)
227+ {
228+ READWRITEAS (CNetAddr, obj);
229+ READWRITE (Using<BigEndianFormatter<2 >>(obj.port ));
230+ }
227231};
228232
229233#endif // PIVX_NETADDRESS_H
You can’t perform that action at this time.
0 commit comments