Fixed bolt client endless loop when server dies.

Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D879
This commit is contained in:
Matej Ferencevic 2017-10-08 12:12:21 +02:00
parent 1f8d532fe9
commit 45a02b56f8

View File

@ -131,7 +131,7 @@ class Client {
std::vector<std::vector<DecodedValue>> records;
while (true) {
if (!GetDataByChunk()) {
throw ClientInvalidDataException();
throw ClientSocketException();
}
if (!decoder_.ReadMessageHeader(&signature, &marker)) {
throw ClientInvalidDataException();
@ -198,7 +198,7 @@ class Client {
while (buffer_.size() < len) {
auto buff = buffer_.Allocate();
int ret = socket_.Read(buff.data, buff.len);
if (ret == -1) return false;
if (ret <= 0) return false;
buffer_.Written(ret);
}
return true;
@ -213,7 +213,7 @@ class Client {
}
auto buff = buffer_.Allocate();
int ret = socket_.Read(buff.data, buff.len);
if (ret == -1) return false;
if (ret <= 0) return false;
buffer_.Written(ret);
}
return true;