summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-02-11 17:33:57 +0200
committerIdan Horowitz <idan.horowitz@gmail.com>2022-02-11 18:11:32 +0200
commit873f4d5de62aab78e8b05efbb3e566de0efa7de4 (patch)
treedcdb0be6c60cd2983040c94f0e4eced992c7a8e4
parent75fe51a9ca4d79d46532a38f62fc04d6e1cd673b (diff)
downloadserenity-873f4d5de62aab78e8b05efbb3e566de0efa7de4.zip
RequestServer: Recreate socket if it reached EOF
This ensures we don't continue using a socket that has EOF'ed (meaning the protocol has disconnected in the case of TCP) for new requests.
-rw-r--r--Userland/Services/RequestServer/ConnectionCache.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Services/RequestServer/ConnectionCache.h b/Userland/Services/RequestServer/ConnectionCache.h
index 61c3ab4c22..07b8e503be 100644
--- a/Userland/Services/RequestServer/ConnectionCache.h
+++ b/Userland/Services/RequestServer/ConnectionCache.h
@@ -106,7 +106,7 @@ template<typename T>
ErrorOr<void> recreate_socket_if_needed(T& connection, URL const& url)
{
using SocketType = typename T::SocketType;
- if (!connection.socket->is_open()) {
+ if (!connection.socket->is_open() || connection.socket->is_eof()) {
// Create another socket for the connection.
auto set_socket = [&](auto socket) -> ErrorOr<void> {
connection.socket = TRY(Core::Stream::BufferedSocket<SocketType>::create(move(socket)));