Skip to content

Instantly share code, notes, and snippets.

@ubergeek42
Created May 16, 2013 18:52
Show Gist options
  • Save ubergeek42/5594109 to your computer and use it in GitHub Desktop.
Save ubergeek42/5594109 to your computer and use it in GitHub Desktop.
Domjudge: Make judgehosts register themselves
diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php
index e9fefb4..a65b9a4 100644
--- a/judge/judgedaemon.main.php
+++ b/judge/judgedaemon.main.php
@@ -101,6 +101,8 @@ while( !$exitsignalled )
$row = $DB->q('MAYBETUPLE SELECT * FROM judgehost WHERE hostname = %s'
, $myhost);
if ( ! $row ) {
+ // self register the judgehost
+ $DB->q('INSERT INTO judgehost SET hostname = %s, active = 1', $myhost);
if($first)
logmsg(LOG_WARNING, "No database entry found for me ($myhost)");
$first = False;
@thijskh
Copy link

thijskh commented May 17, 2013

I like the idea, but I'm still on the fence on whether you want active to default to 1 or 0.

In any case you should be changing the code after that aswell: in any case remove the sleep, but probably the entire while() can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment