Fix large Bolt messages

Reviewers: ipaljak

Reviewed By: ipaljak

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1490
This commit is contained in:
Matej Ferencevic 2018-07-12 11:44:59 +02:00
parent 2590bcb7db
commit 53ee007002
2 changed files with 7 additions and 0 deletions

View File

@ -72,6 +72,11 @@ class Session {
*/
void Execute() {
if (UNLIKELY(!handshake_done_)) {
// Resize the input buffer to ensure that a whole chunk can fit into it.
// This can be done only once because the buffer holds its size.
input_stream_.Resize(WHOLE_CHUNK_SIZE);
// Receive the handshake.
if (input_stream_.size() < HANDSHAKE_SIZE) {
DLOG(WARNING) << fmt::format("Received partial handshake of size {}",
input_stream_.size());

View File

@ -34,6 +34,8 @@ class TestInputStream {
data_.erase(data_.begin(), data_.begin() + count);
}
void Resize(size_t len) {}
private:
std::vector<uint8_t> data_;
};