Re: Resolving "daemon"

From: James Turner (turnerjh@XTN.NET)
Date: 07/14/98

"Mark A. Heilpern" <heilpern@MINDSPRING.COM> writes:

> Seems to me there's already a patch that does exactly this on the
> ftp site. Might even be two or three.

There are some that almost do the same, but not quite.  The purpose of
what I'm writing isn't just for a mud; it will be general enough to be
useable in much more than just a mud program.  I've looked a bit but
not found a satisfactory solution to asynchronous name lookups.
Hopefully this will accomplish it using a minimum of system resources
and with enough simplicity to be easily added to other programs.

> If you wish to write it from scratch anyway, I'd reccommend seeing if
> you have the "pthread" library installed and, if so, using it. Tho, there are
> really several ways to accomplish this. A "fun" one, especially if you're on
> a server with several muds running, might be to make an RPC server to
> respond to every mud's request. It could accept an ip address and a
> descriptor accress (for the character descriptor pointer) as input to one
> function call, look up the answer, and have another function call that
> basically asks "got an answer for descriptor XXXX yet?" to be polled for
> an answer, to avoid blocking on it.

Pthreads is not the way to go, since it wouldn't be a general
solution.  Here's the archetecture I'll be using:

1. Player connects
2. Mud calls asynchronous lookup with the request.  Sets player's
state to CON_LOOKUP.  Skip to next character or new connection.
3. Check the lookup results which are basically of the form "#.#.#.#".  If a given descriptor's address is there, copy the
resolved name in.  If not, skip again.  Don't let anyone in til either
their host is resolved or it comes back as numeric only.

The async lookup will work by having a program floating around on the
server, listening to a SYSV IPC message queue.  It will receive
requests and dispatch results.  Minimal resource usage, since the mud
isn't spinning or anything and the daemon is almost always idle either
waiting for a request for a resolution.

James Turner               UIN: 1102038

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST