mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
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.
This commit is contained in:
parent
75fe51a9ca
commit
873f4d5de6
1 changed files with 1 additions and 1 deletions
|
@ -106,7 +106,7 @@ template<typename T>
|
||||||
ErrorOr<void> recreate_socket_if_needed(T& connection, URL const& url)
|
ErrorOr<void> recreate_socket_if_needed(T& connection, URL const& url)
|
||||||
{
|
{
|
||||||
using SocketType = typename T::SocketType;
|
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.
|
// Create another socket for the connection.
|
||||||
auto set_socket = [&](auto socket) -> ErrorOr<void> {
|
auto set_socket = [&](auto socket) -> ErrorOr<void> {
|
||||||
connection.socket = TRY(Core::Stream::BufferedSocket<SocketType>::create(move(socket)));
|
connection.socket = TRY(Core::Stream::BufferedSocket<SocketType>::create(move(socket)));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue