Prevent parsing error for empty client commands

This commit is contained in:
Sebastian Serth
2020-10-08 14:43:22 +02:00
parent 13b6e50573
commit fcd393b9d5

View File

@ -184,6 +184,8 @@ class SubmissionsController < ApplicationController
# Check whether the client send a JSON command and kill container
# if the command is 'client_kill', send it to docker otherwise.
begin
next if data == "\n"
parsed = JSON.parse(data)
if parsed.class == Hash && parsed['cmd'] == 'client_kill'
Rails.logger.debug("Client exited container.")