[Commit] rrserver dispatch.5c,1.13,1.14 games.5c,1.12,1.13
protocol,1.21,1.22 readreq.5c,1.7,1.8 rr.5c,1.6,1.7
Keith Packard
commit at keithp.com
Fri May 30 20:45:29 PDT 2003
Committed by: keithp
Update of /local/src/CVS/rrserver
In directory home.keithp.com:/tmp/cvs-serv13975
Modified Files:
dispatch.5c games.5c protocol readreq.5c rr.5c
Log Message:
Add DISPOSE
Index: dispatch.5c
===================================================================
RCS file: /local/src/CVS/rrserver/dispatch.5c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- dispatch.5c 31 May 2003 00:11:31 -0000 1.13
+++ dispatch.5c 31 May 2003 02:45:27 -0000 1.14
@@ -412,6 +412,13 @@
Games::add_client (&g, &c, false);
respond ("WATCH\n");
}
+
+ void dispose (string game) {
+ assert_user ();
+ &Game g = Games::find (game);
+ Games::dispose (&g);
+ respond ("DISPOSE\n");
+ }
void show () {
assert_user ();
@@ -567,6 +574,9 @@
break;
case WATCH w:
watch (w.game);
+ break;
+ case DISPOSE d:
+ dispose (d.game);
break;
case SHOW:
show ();
Index: games.5c
===================================================================
RCS file: /local/src/CVS/rrserver/games.5c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- games.5c 31 May 2003 00:11:31 -0000 1.12
+++ games.5c 31 May 2003 02:45:27 -0000 1.13
@@ -340,6 +340,15 @@
return &g;
}
+ public void dispose (&Game g) {
+ void bail (&Client c) {
+ raise error (Error.NOTEMPTY);
+ }
+ iterate_client (&g, bail, true, false);
+ remove (&g);
+ Clients::server_send ("NOTICE DISPOSE %s\n", g.name);
+ }
+
void next_game (&Game g) {
ClientRef winner = ClientRef.none;
void find_winner (&Client c) {
Index: protocol
===================================================================
RCS file: /local/src/CVS/rrserver/protocol,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- protocol 30 May 2003 23:13:38 -0000 1.21
+++ protocol 31 May 2003 02:45:27 -0000 1.22
@@ -154,6 +154,18 @@
Possible errors: NOGAME
+1.10. Dispose an empty game
+
+ DISPOSE <game>
+
+ ->
+
+ DISPOSE
+
+ Disposes <game> unless it still has players associated.
+
+ Possible errors: NOGAME NOTEMPTY
+
1.10. Get the game contents
SHOW
@@ -528,7 +540,13 @@
+ showing and not all passed
is true
-
+
+3.9. Not empty
+
+ ERROR NOTEMPTY
+
+ DISPOSE was requested for a game with active players
+
3.8. Command
ERROR COMMAND
Index: readreq.5c
===================================================================
RCS file: /local/src/CVS/rrserver/readreq.5c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- readreq.5c 31 May 2003 00:11:31 -0000 1.7
+++ readreq.5c 31 May 2003 02:45:27 -0000 1.8
@@ -126,6 +126,11 @@
game_ (&packet);
req = (Request.WATCH) packet;
break;
+ case "DISPOSE":
+ packet = (struct { string game; }) {};
+ game_ (&packet);
+ req = (Request.DISPOSE) packet;
+ break;
case "SHOW":
req = Request.SHOW;
break;
Index: rr.5c
===================================================================
RCS file: /local/src/CVS/rrserver/rr.5c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- rr.5c 30 May 2003 23:13:38 -0000 1.6
+++ rr.5c 31 May 2003 02:45:27 -0000 1.7
@@ -98,6 +98,9 @@
struct {
string game;
} WATCH;
+ struct {
+ string game;
+ } DISPOSE;
void SHOW;
struct {
int number;
@@ -212,6 +215,7 @@
NOTFINISHED,
NOTNUMBER,
BLOCKED,
+ NOTEMPTY,
COMMAND,
SYNTAX,
NOTCOLOR,
More information about the Commit
mailing list