MongoosePeople. Places. Questionable inventions.

All help topics · Link to this topic

Showing help on 'connection_name_lookup()'

Syntax: connection_name_lookup (OBJ <connection> [, INT record_result]) => STR

This function performs a DNS name lookup on connection's IP address. If a hostname can't be resolved, the function simply returns the numeric IP address. Otherwise, it will return the resolved hostname.

If record_result is true, the resolved hostname will be saved with the connection and will overwrite it's existing 'connection_name()'. This means that you can call 'connection_name_lookup()' a single time when a connection is created and then continue to use 'connection_name()' as you always have in the past.

This function is primarily intended for use when the 'NO_NAME_LOOKUP' server option is set. Barring temporarily failures in your nameserver, very little will be gained by calling this when the server is performing DNS name lookups for you.

NOTE: This function runs in a separate thread. While this is good for performance (long lookups won't lock your MOO like traditional pre-2.6.0 name lookups), it also means it will require slightly more work to create an entirely in-database DNS lookup solution. Because it explicitly suspends, you won't be able to use it in 'do_login_command()' without also using the 'switch_player()' function. For an example of how this can work, see '#0:do_login_command()' in ToastCore.