zero-copy message receive

Construct messages from a reference-counted buffer allocated once
per receive instead of copying the data.
This commit is contained in:
Jens Auer
2015-05-29 23:54:43 +02:00
parent 611e96c701
commit e9b403a7b1
6 changed files with 273 additions and 67 deletions

View File

@@ -36,7 +36,9 @@ namespace zmq
{
// Decoder for ZMTP/1.0 protocol. Converts data batches into messages.
class v1_decoder_t : public decoder_base_t <v1_decoder_t>
class v1_decoder_t :
public zmq::c_single_allocator,
public decoder_base_t <v1_decoder_t>
{
public:
@@ -47,10 +49,10 @@ namespace zmq
private:
int one_byte_size_ready ();
int eight_byte_size_ready ();
int flags_ready ();
int message_ready ();
int one_byte_size_ready (unsigned char const*);
int eight_byte_size_ready (unsigned char const*);
int flags_ready (unsigned char const*);
int message_ready (unsigned char const*);
unsigned char tmpbuf [8];
msg_t in_progress;