From 873f4d5de62aab78e8b05efbb3e566de0efa7de4 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Fri, 11 Feb 2022 17:33:57 +0200 Subject: [PATCH] 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. --- Userland/Services/RequestServer/ConnectionCache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ErrorOr 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 { connection.socket = TRY(Core::Stream::BufferedSocket::create(move(socket)));