From: Yingxin Cheng Date: Thu, 21 Mar 2019 14:21:07 +0000 (+0800) Subject: crimson/net: fix Socket::read_exactly(0) case X-Git-Tag: v15.1.0~3027^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b6beb6888541cdad67b6bf0c4e6198ce31219c42;p=ceph.git crimson/net: fix Socket::read_exactly(0) case Do not raise read_eof when try to read 0 bytes. Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/net/Socket.cc b/src/crimson/net/Socket.cc index a22e9b2eac66..3ea65d41a54b 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()) {