summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCore
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-02-02 19:09:05 +0330
committerAndreas Kling <kling@serenityos.org>2022-02-06 13:10:10 +0100
commit7a95c451a3bc4eb379e12c8243b878f73a3dd03d (patch)
treea4bd2a164f2e34cd5d02002fdefd687d9d32937a /Userland/Libraries/LibCore
parent9ee5107871d129abcc97fb8fd24510417caf9072 (diff)
downloadserenity-7a95c451a3bc4eb379e12c8243b878f73a3dd03d.zip
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).
Diffstat (limited to 'Userland/Libraries/LibCore')
-rw-r--r--Userland/Libraries/LibCore/Stream.h3
1 files changed, 3 insertions, 0 deletions
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;