From 27471b9fd27f8205cc8e3d169f05a34a99104c72 Mon Sep 17 00:00:00 2001 From: ohadvano <49730675+ohadvano@users.noreply.github.com> Date: Sun, 1 Oct 2023 16:27:08 +0300 Subject: [PATCH] subtract already read bytes from required frame length Signed-off-by: ohadvano <49730675+ohadvano@users.noreply.github.com> --- test/integration/fake_upstream.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/integration/fake_upstream.h b/test/integration/fake_upstream.h index bf3b3bba0394..341f85a7fd0f 100644 --- a/test/integration/fake_upstream.h +++ b/test/integration/fake_upstream.h @@ -194,15 +194,18 @@ class FakeStream : public Http::RequestDecoder, if (!waitForData(client_dispatcher, 5, timeout)) { return testing::AssertionFailure() << "Timed out waiting for start of gRPC message."; } + int last_body_size = 0; { absl::MutexLock lock(&lock_); + last_body_size = body_.length(); if (!grpc_decoder_.decode(body_, decoded_grpc_frames_)) { return testing::AssertionFailure() << "Couldn't decode gRPC data frame: " << body_.toString(); } } if (decoded_grpc_frames_.empty()) { - if (!waitForData(client_dispatcher, grpc_decoder_.length(), bound.timeLeft())) { + if (!waitForData(client_dispatcher, grpc_decoder_.length() - last_body_size, + bound.timeLeft())) { return testing::AssertionFailure() << "Timed out waiting for end of gRPC message."; } {