From 7a95c451a3bc4eb379e12c8243b878f73a3dd03d Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Wed, 2 Feb 2022 19:09:05 +0330 Subject: [PATCH] LibCore: Stop buffering when a zero-size slice is read regardless of EOF The meaning of EOF depends on the underlying socket, but an empty slice should terminate the buffering (otherwise we'd just spin forever). --- Userland/Libraries/LibCore/Stream.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Libraries/LibCore/Stream.h b/Userland/Libraries/LibCore/Stream.h index b074fe8ded..dceb631de8 100644 --- a/Userland/Libraries/LibCore/Stream.h +++ b/Userland/Libraries/LibCore/Stream.h @@ -664,6 +664,9 @@ public: if (populated_slice.contains_slow('\n')) return true; + + if (populated_slice.is_empty()) + break; } return false;