MOO-cows Mailing List Archive


Re: More force_input() and $do_command()...

Gustavo Glusman writes:
> Forcing input on a non-connected positive-number object does *not* call
> :do_login_command.

Quite right; I wrote without thinking very hard or looking at the sources last
time.  I've now done at least the latter, so here's the correct story:

Every line of forced input goes to either L:do_login_command() or
L:do_command(), depending *only* on whether the object being forced is negative
or not (respectively).  The tricky point, though, is the value of L in the
above.  For inbound connections, L is the listening object.  For outbound
connections, L is always #0.  What about for *non*-connections?  Well, that
there's what we call a little "bug" in the code: the appropriate field in the
task queue structure is never explicitly filled in by the code, so it gets some
random (and probably large) value.  This is extremely unlikely to be a valid
object number, so the above verb call is simply skipped, leading to the results
that Gustavo saw in his experiment:

> Objnum       Connection    is_player()        Result of force_input()
> ------       ----------    -----------        -----------------------
>   #2           active         yes                  $do_command
> #-12          incoming        no                   $do_login_command
>  #-5            none          no                   None
> #131            none          no                   None
> #133            none          yes                  None

The simplest fix is to treat the forcing case like the outbound one and
initialize L to #0.  To do this, add this line:
	tq->handler = 0;
just after this line:
	tq->player = player;
in the function find_tqueue() in the file "tasks.c".

With luck, the next maintainer will add this patch in the next release.
(Speaking of the next maintainer, where *is* he?  He was supposed to get back
to me some weeks ago, once he'd gotten settled in his new job...)


Follow-Ups: References:

Home | Subject Index | Thread Index