Commit aac32053 authored by Wladimir J. van der Laan's avatar Wladimir J. van der Laan
Browse files

src/netbase.h: Fix endian in CNetAddr serialization

We've chosen to htons/ntohs explicitly on reading and writing
(I do not know why). But as READWRITE already does an endian swap
on big endian, this means the port number gets switched around,
which was what we were trying to avoid in the first place. So
to make this compatible, serialize it as FLATDATA.
parent 01f9c344
Showing with 1 addition and 1 deletion
+1 -1
......@@ -162,7 +162,7 @@ class CService : public CNetAddr
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(ip));
unsigned short portN = htons(port);
READWRITE(portN);
READWRITE(FLATDATA(portN));
if (ser_action.ForRead())
port = ntohs(portN);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment