aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-03-24 16:52:24 +0100
committerPieter Wuille <sipa@ulyssis.org>2013-03-29 23:56:26 +0100
commit41b052ad87633d5a8a989c512c8710b875f2ba88 (patch)
tree0337b36bb1ced74a3f1400d840c191f9c738dd3d /src/serialize.h
parent967f24590b43f0f84148f669d886b40fe45aa978 (diff)
downloadbitcoin-41b052ad87633d5a8a989c512c8710b875f2ba88.tar.xz
Use per-message send buffer, rather than per connection
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/serialize.h b/src/serialize.h
index f2626281c1..e3d9939bcc 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -789,6 +789,7 @@ struct ser_streamplaceholder
+typedef std::vector<char, zero_after_free_allocator<char> > CSerializeData;
/** Double ended buffer combining vector and stream-like interfaces.
*
@@ -798,7 +799,7 @@ struct ser_streamplaceholder
class CDataStream
{
protected:
- typedef std::vector<char, zero_after_free_allocator<char> > vector_type;
+ typedef CSerializeData vector_type;
vector_type vch;
unsigned int nReadPos;
short state;
@@ -1095,6 +1096,11 @@ public:
::Unserialize(*this, obj, nType, nVersion);
return (*this);
}
+
+ void GetAndClear(CSerializeData &data) {
+ vch.swap(data);
+ CSerializeData().swap(vch);
+ }
};