aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-09-01 21:00:32 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2014-09-01 21:23:01 +0200
commit2e731f24b5a5c894e013a6d752f1cd409303e916 (patch)
tree94ba6f1e3ab9ecb5ac1696b48b1aabc859aa8365 /src/netbase.h
parentf6a81050372810d8eebc15523bde28e91d045314 (diff)
parent31e9a8384a77947f6777d035992f4734618ed206 (diff)
Merge pull request #4737
31e9a83 Use CSizeComputer to avoid counting sizes in SerializationOp (Pieter Wuille) 84881f8 rework overhauled serialization methods to non-static (Kamil Domanski) 5d96b4a remove fields of ser_streamplaceholder (Kamil Domanski) 3d796f8 overhaul serialization code (Kamil Domanski)
Diffstat (limited to 'src/netbase.h')
-rw-r--r--src/netbase.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/netbase.h b/src/netbase.h
index d4d266e0a8..9b52c0a415 100644
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -88,10 +88,12 @@ class CNetAddr
friend bool operator!=(const CNetAddr& a, const CNetAddr& b);
friend bool operator<(const CNetAddr& a, const CNetAddr& b);
- IMPLEMENT_SERIALIZE
- (
- READWRITE(FLATDATA(ip));
- )
+ IMPLEMENT_SERIALIZE;
+
+ template <typename Stream, typename Operation>
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ READWRITE(FLATDATA(ip));
+ }
};
class CSubNet
@@ -148,15 +150,17 @@ class CService : public CNetAddr
CService(const struct in6_addr& ipv6Addr, unsigned short port);
CService(const struct sockaddr_in6& addr);
- IMPLEMENT_SERIALIZE
- (
- CService* pthis = const_cast<CService*>(this);
- READWRITE(FLATDATA(ip));
- unsigned short portN = htons(port);
- READWRITE(portN);
- if (fRead)
- pthis->port = ntohs(portN);
- )
+ IMPLEMENT_SERIALIZE;
+
+ template <typename Stream, typename Operation>
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
+ bool fRead = ser_action.ForRead();
+ READWRITE(FLATDATA(ip));
+ unsigned short portN = htons(port);
+ READWRITE(portN);
+ if (fRead)
+ port = ntohs(portN);
+ }
};
typedef CService proxyType;