From 17b95ed64715ca26ad711029fe9959715bcfab13 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Tue, 12 Nov 2024 20:31:18 +0100 Subject: [PATCH] Gracefully handle tubesock handshake failures for run --- app/controllers/submissions_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 8a22cc8dd..e54e93322 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -168,6 +168,9 @@ def run # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplex # If running is not allowed (and the socket is closed), we can stop here. return true if @embed_options[:disable_run] + # If the tubesock handshake failed (and we didn't got a socket), we can stop here. + # With our custom tubesock patch, this will render a 426 status code already. + return true if client_socket.nil? @testrun[:output] = +'' durations = @submission.run(@file) do |socket, starting_time|