From b6beb6888541cdad67b6bf0c4e6198ce31219c42 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Thu, 21 Mar 2019 22:21:07 +0800 Subject: [PATCH] crimson/net: fix Socket::read_exactly(0) case Do not raise read_eof when try to read 0 bytes. Signed-off-by: Yingxin Cheng --- src/crimson/net/Socket.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/crimson/net/Socket.cc b/src/crimson/net/Socket.cc index a22e9b2eac66f..3ea65d41a54b5 100644 --- a/src/crimson/net/Socket.cc +++ b/src/crimson/net/Socket.cc @@ -69,6 +69,9 @@ seastar::future Socket::read(size_t bytes) seastar::future> Socket::read_exactly(size_t bytes) { + if (bytes == 0) { + return seastar::make_ready_future>(); + } return in.read_exactly(bytes) .then([this](auto buf) { if (buf.empty()) { -- 2.39.5