diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-12-18 22:07:31 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-06 17:21:58 +0100 |
commit | aac320537523f1df1523adeba22a8498884715c9 (patch) | |
tree | 8fff77336fa1a0b79090de8d9da288e7743303d1 /src/netbase.h | |
parent | 01f9c3449a88748722dd51c7b54305fd1ba87359 (diff) |
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.
Diffstat (limited to 'src/netbase.h')
-rw-r--r-- | src/netbase.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/netbase.h b/src/netbase.h index 5bf13a673f..b42c2dffa4 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -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); } |