summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbjj <bjj>2003-06-12 18:16:56 (GMT)
committerbjj <bjj>2003-06-12 18:16:56 (GMT)
commit29e08facdf6416cfe0df16c863bb89400e1d84f9 (patch)
tree45e9561a416de515c55fd063983abe84c550f0a1
parent45ec5a42953676a190b550a0de6aed62dc1d0b7e (diff)
downloadmoo-29e08facdf6416cfe0df16c863bb89400e1d84f9.zip
moo-29e08facdf6416cfe0df16c863bb89400e1d84f9.tar.gz
moo-29e08facdf6416cfe0df16c863bb89400e1d84f9.tar.bz2
moo-29e08facdf6416cfe0df16c863bb89400e1d84f9.tar.xz
Suspend input on connection until :do_login_command() can run.
-rw-r--r--server.c13
-rw-r--r--tasks.c14
-rw-r--r--tasks.h4
3 files changed, 30 insertions, 1 deletions
diff --git a/server.c b/server.c
index 6d610b6..5d47535 100644
--- a/server.c
+++ b/server.c
@@ -964,8 +964,16 @@ server_new_connection(server_listener sl, network_handle nh, int outbound)
h->binary = 0;
h->print_messages = (!outbound && l->print_messages);
- if (!outbound)
+ if (!outbound) {
new_input_task(h->tasks, "");
+ /*
+ * Suspend input at the network level until the above input task
+ * is processed. At the point when it is dequeued, tasks.c will
+ * notice that the queued input size is below the low water mark
+ * and resume input.
+ */
+ task_suspend_input(h->tasks);
+ }
oklog("%s: #%d on %s\n",
outbound ? "CONNECT" : "ACCEPT",
@@ -1739,6 +1747,9 @@ char rcsid_server[] = "$Id$";
/*
* $Log$
+ * Revision 1.6 2003/06/12 18:16:56 bjj
+ * Suspend input on connection until :do_login_command() can run.
+ *
* Revision 1.5 1998/12/29 06:56:32 nop
* Fixed leak in onc().
*
diff --git a/tasks.c b/tasks.c
index fdd73eb..12a14f9 100644
--- a/tasks.c
+++ b/tasks.c
@@ -725,6 +725,17 @@ enqueue_input_task(tqueue * tq, const char *input, int at_front)
}
}
+void
+task_suspend_input(task_queue q)
+{
+ tqueue *tq = q.ptr;
+
+ if (!tq->input_suspended && tq->connected) {
+ server_suspend_input(tq->player);
+ tq->input_suspended = 1;
+ }
+}
+
static void
flush_input(tqueue * tq, int show_messages)
{
@@ -2013,6 +2024,9 @@ char rcsid_tasks[] = "$Id$";
/*
* $Log$
+ * Revision 1.11 2003/06/12 18:16:56 bjj
+ * Suspend input on connection until :do_login_command() can run.
+ *
* Revision 1.10 2002/09/15 23:21:01 xplat
* GNU indent normalization.
*
diff --git a/tasks.h b/tasks.h
index 81ba473..e6ebfd8 100644
--- a/tasks.h
+++ b/tasks.h
@@ -36,6 +36,7 @@ extern int tasks_set_connection_option(task_queue, const char *,
Var);
extern void new_input_task(task_queue, const char *);
+extern void task_suspend_input(task_queue);
extern enum error enqueue_forked_task2(activation a, int f_index,
unsigned after_seconds, int vid);
extern enum error enqueue_suspended_task(vm the_vm, void *data);
@@ -110,6 +111,9 @@ extern db_verb_handle find_verb_for_programming(Objid player,
/*
* $Log$
+ * Revision 1.4 2003/06/12 18:16:57 bjj
+ * Suspend input on connection until :do_login_command() can run.
+ *
* Revision 1.3 1998/12/14 13:19:08 nop
* Merge UNSAFE_OPTS (ref fixups); fix Log tag placement to fit CVS whims
*