MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Lambda MOO Error or Poor Programming?



>   The server isn't working as you would expect it to do... The server
>   takes
> the return value from #0:do_login_command at first read() or suspend(),
> and forget about it, ignoring it is still running or not. The point is
> the server is written in C, and the protocol between MOO codes is
> meaningless to the server.
>   I wrote a patch for this purpose before, and you can get it from
> ftp://ee.snu.ac.kr/users/jsahn/moo-1.7.9-read.gz, though it breaks
> the interface between server and db slightly...

You don't need a server patch to fix this problem, just some different 
thinking.  The method DU uses (and has used for a long time) for this is 
the following:

1.  In $login:connect, if the user doesn't give a password for the
"connect" command, print a password prompt, turn off echo, and save a
"state indicator" to a property on $login (i.e. something saying that
connection #-123 is in password-reading mode for account "Xyzzy") and
then return.
2.  In $login:parse_command, check to see whether the connection the 
command is coming from has an entry indicating it's in "read mode".  If 
so, zap the state indicator, and tell #0:do_login_command to call 
$login:connect with the appropriate args and the password, instead of what 
would normally be done.
3.  Set up something to sweep the connection-state info periodically to 
clean out info for any connections which disconnected while reading (I 
just added another thing in :parse_command which checks to make sure all 
of the connections listed in the data prop are still connected whenever 
someone gives a login command).

This gives a seamless appearance of read()ing without actually doing it, 
which avoids the problem you're experiencing.

-R
-----------------------------------------------------------------------------
      Alex Stewart - riche@crl.com - Richelieu @ Diversity University MOO
                          http://www.crl.com/~riche/
            "Difficult answers lead to intelligent questions."


Follow-Ups:

Home | Subject Index | Thread Index