Fixed wrong buffer end detection in v2_decoder.

zero-copy msg_t::init cannot be used when the message exceeds either
the buffer end or the last received byte. To detect this, the buffer
is now resized to the numnber of received bytes.
This commit is contained in:
Jens Auer
2015-06-10 22:09:55 +02:00
parent b3f2acf7d6
commit dfe1908008
6 changed files with 29 additions and 2 deletions

View File

@@ -73,6 +73,10 @@ namespace zmq
return bufsize;
}
void resize(size_t new_size)
{
bufsize = new_size;
}
private:
size_t bufsize;
unsigned char* buf;
@@ -190,6 +194,11 @@ namespace zmq
return 0;
}
virtual void resize_buffer(size_t new_size)
{
allocator->resize(new_size);
}
protected:
// Prototype of state machine action. Action should return false if