From 3f2f8d57b20a3b9099f7dd9a5f69fdff9d08e6a7 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 29 Jun 2007 16:41:33 +0200 Subject: [PATCH] Implemented NOP command and used it for testing that the server still exists. --- submit/PROTOCOL | 8 ++++++++ submit/commands.c | 2 ++ submit/contest | 9 ++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/submit/PROTOCOL b/submit/PROTOCOL index fcd1106..2307ddb 100644 --- a/submit/PROTOCOL +++ b/submit/PROTOCOL @@ -54,6 +54,14 @@ Status reply: Aallowed_extension ) +NOP request: + + !NOP + +NOP reply: + + (only status) + Task status objects ~~~~~~~~~~~~~~~~~~~ diff --git a/submit/commands.c b/submit/commands.c index 7ecd781..1e57605 100644 --- a/submit/commands.c +++ b/submit/commands.c @@ -308,6 +308,8 @@ execute_command(struct conn *c) cmd_submit(c); else if (!strcasecmp(cmd, "STATUS")) cmd_status(c); + else if (!strcasecmp(cmd, "NOP")) + ; else err(c, "Unknown command"); } diff --git a/submit/contest b/submit/contest index 811a0f1..29b046e 100755 --- a/submit/contest +++ b/submit/contest @@ -154,7 +154,7 @@ my $refresh_timer_id; sub timed_refresh() { - refresh(); # FIXME: If-modified-since version? + refresh(); return 1; # We wish to re-run the timer } @@ -279,8 +279,7 @@ my %submit_fn_cache = (); sub end_submit($) { my ($close) = @_; $subwin->destroy if $close; - start_refresh_timer(0); - ### FIXME: ... and refresh status + start_refresh_timer(1); } sub finish_submit() { @@ -325,14 +324,14 @@ sub run_submit() { if ($conn->is_connected) { busy("Checking server status..."); - my $r = new Sherlock::Object("!" => "STATUS"); ### FIXME: use a NOP command + my $r = new Sherlock::Object("!" => "NOP"); $r = $conn->request($r); } if (!$conn->is_connected) { busy("Reconnecting to server..."); if (!$conn->connect) { ready($conn->{"error"}); - submit_failed("Unable to connect to the server"); ### FIXME: Mention local submit + submit_failed("Unable to connect to the server"); return; } } -- 2.39.2