[DGD] While loop in auto object this_user() purpose

Gary gary at mups.co.uk
Mon Mar 20 22:46:55 CET 2017


auto.c has a this_user() method as follows:-

  static object this_user()
  {
      object user;

      user = ::this_user();
      while (user && user <- LIB_CONN) {
          user = user->query_user();
      }
      return user;
  }

I'm curious as to why the need for the while loop.

afaict in all places "user" is set in the connection object, (via the
result of telnet_user()/binary_user() or due to a redirect() call) the
object that query_user() would return appears to be LIB_USER derived.

In which case a single user->query_user() call would be sufficient to
obtain a user object rather than conn object.

Is there a scenario that could result in user->query_user() returning a
LIB_CONN instead in an unmodified kernel lib?

If not, what was the anticipated reason a LIB_CONN might be returned by
query_user() to necessitate a loop?


Also, as an aside, what is the correct terminology for the auto
this_user method? Is it a kfun or efun or neither?


Regards,

Gary



More information about the DGD mailing list