From fdfd4b5e3d89a079975a91f6d13a5420c2f33736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Sat, 30 Dec 2023 01:52:07 +0100 Subject: [PATCH] pixelflut: Ignore EAGAIN errors Very contested servers are likely to cause EAGAIN socket errors on the client. Since these errors are not supposed to be fatal, just try sending the pixel again. This was tested successfully against massively contested 37c3 pixelflut servers. --- Userland/Utilities/pixelflut.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/pixelflut.cpp b/Userland/Utilities/pixelflut.cpp index a087bd5ef7..a2b4eb2ae5 100644 --- a/Userland/Utilities/pixelflut.cpp +++ b/Userland/Utilities/pixelflut.cpp @@ -118,7 +118,12 @@ ErrorOr Client::send_current_pixel() auto hex_without_hash = hex.substring(1); // PX - TRY(m_socket->write_formatted("PX {} {} {}\n", m_current_point.x() + m_image_offset.x(), m_current_point.y() + m_image_offset.y(), hex_without_hash)); + while (true) { + auto result = m_socket->write_formatted("PX {} {} {}\n", m_current_point.x() + m_image_offset.x(), m_current_point.y() + m_image_offset.y(), hex_without_hash); + // Very contested servers will cause frequent EAGAIN errors. + if (!result.is_error() || result.error().code() != EAGAIN) + break; + } return {}; }