diff rlgwebd.js @ 109:67b393f10c2b

RLG-Web: improve taking over sessions. WebSocket sessions should not be taken over, and polling sessions are not yet convertible to WebSockets. Eventually the current method of taking over via Player#reset() should be replaced with autosaving the game, which will always work.
author John "Elwin" Edwards <elwin@sdf.org>
date Sun, 15 Jul 2012 20:30:33 -0700
parents b64e31c5ec31
children 18a81cc0084b
line wrap: on
line diff
--- a/rlgwebd.js	Sun Jul 15 18:18:53 2012 -0700
+++ b/rlgwebd.js	Sun Jul 15 20:30:33 2012 -0700
@@ -756,7 +756,7 @@
     var nodematch = new RegExp("^" + username + ":node:");
     if (fname && (fname.match(nodematch) === null)) {
       /* It's being played in dgamelaunch. */
-      sendError(res, 4, null);
+      sendError(res, 4, "dgamelaunch");
       tslog("%s is already playing %s", username, gname);
       return;
     }
@@ -786,7 +786,9 @@
           return;
         }
       }
-      sendError(res, 7);
+      /* If there's no player, it's a WebSocket game, and shouldn't be 
+       * seized. */
+      sendError(res, 4, "WebSocket");
     }
     else {
       new Player(gname, lkey, dims, respondlaunch);