aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2014-08-21 00:49:32 +0200
committerKamil Domanski <kdomanski@kdemail.net>2014-08-31 02:18:42 +0200
commit31e9a8384a77947f6777d035992f4734618ed206 (patch)
tree9a055fbae630bad4b7982a5aae1294a9579382cb /src/netbase.h
parent84881f8c472cc67dc757686eb7dc3b495b13cab8 (diff)
downloadbitcoin-31e9a8384a77947f6777d035992f4734618ed206.tar.xz
Use CSizeComputer to avoid counting sizes in SerializationOp
Diffstat (limited to 'src/netbase.h')
-rw-r--r--src/netbase.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/netbase.h b/src/netbase.h
index b4ba711261..1ea37519a6 100644
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -91,10 +91,8 @@ class CNetAddr
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- size_t nSerSize = 0;
+ inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
READWRITE(FLATDATA(ip));
- return nSerSize;
}
};
@@ -155,16 +153,13 @@ class CService : public CNetAddr
IMPLEMENT_SERIALIZE;
template <typename Stream, typename Operation>
- inline size_t SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
- bool fRead = boost::is_same<Operation, CSerActionUnserialize>();
- size_t nSerSize = 0;
- CService* pthis = const_cast<CService*>(this);
+ 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)
- pthis->port = ntohs(portN);
- return nSerSize;
+ port = ntohs(portN);
}
};