Use per-message send buffer, rather than per connection

This commit is contained in:
Pieter Wuille
2013-03-24 16:52:24 +01:00
committed by Pieter Wuille
parent 967f24590b
commit 41b052ad87
5 changed files with 85 additions and 61 deletions

View File

@@ -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);
}
};