Skip to content

Commit

Permalink
MB-48292: Don't clear buffer message when bytes received by libuv is 0
Browse files Browse the repository at this point in the history
Change-Id: I1600e1d398e1d76a132cfe4e25bd10ef1a5aa8d5
Reviewed-on: http://review.couchbase.org/c/eventing/+/159865
Reviewed-by: Jeelan Basha Poola <jeelan.poola@couchbase.com>
Reviewed-by: CI Bot
Tested-by: <ankit.prabhu@couchbase.com>
(cherry picked from commit 9986391)
Reviewed-on: http://review.couchbase.org/c/eventing/+/164408
Well-Formed: Restriction Checker
Tested-by: Jeelan Basha Poola <jeelan.poola@couchbase.com>
  • Loading branch information
AnkitPrabhu authored and jeelanp2003 committed Oct 27, 2021
1 parent c6f7e33 commit 2adcdd4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions v8_consumer/src/client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,16 @@ void AppWorker::OnRead(uv_stream_t *stream, ssize_t nread,
const uv_buf_t *buf) {
if (nread > 0) {
AppWorker::GetAppWorker()->ParseValidChunk(stream, nread, buf->base);
} else if (nread == 0) {
next_message_.clear();
} else {
} else if (nread < 0) {
if (nread != UV_EOF) {
LOG(logError) << "Read error, err code: " << uv_err_name(nread)
<< std::endl;
}
AppWorker::GetAppWorker()->ParseValidChunk(stream, next_message_.length(),
next_message_.c_str());

std::string old_message_ = next_message_;
next_message_.clear();
AppWorker::GetAppWorker()->ParseValidChunk(stream, old_message_.length(),
old_message_.c_str());
uv_read_stop(stream);
}
}
Expand Down

0 comments on commit 2adcdd4

Please sign in to comment.