Created
May 16, 2013 18:52
-
-
Save ubergeek42/5594109 to your computer and use it in GitHub Desktop.
Domjudge: Make judgehosts register themselves
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.