fluffos/docs/efun/interactive/resolve.md
Claude b0f61c3313 Preserve this_player() in resolve() and async_* callbacks (#1104)
resolve(), async_read(), async_write(), async_getdir() and
async_db_exec() ran their callbacks with no user context, so
this_player() returned 0 and input_to()/printf() were unusable there.

Follow the call_out() precedent: capture command_giver (ref-held) when
the request is registered and restore it around the callback, skipping
destructed objects, gated on the same 'this_player in call_out'
setting. The pending-request holders account for the new ref in the
DEBUGMALLOC walkers.

The new test registers callbacks from two different living objects and
asserts each callback sees its own registrant, which fails without the
per-request capture.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Lv2Gw2AWqtyN3nNEgob1He
2026-07-11 14:56:46 -04:00

1.1 KiB
Raw Permalink Blame History

title
interactive / resolve

resolve

NAME

resolve() - resolve an internet address to domain name, or vice versa

SYNOPSIS

int resolve( string address, string callback_func );

DESCRIPTION

resolve()  resolves  'address',  which should be an internet address in
the form "127.0.0.1" or a domain name, into its domain name, or  inter
net  address.   When  the  resolve is complete, 'callback_func' will be
called in the current object.  The form of the callback is:

void callback(string address, string resolved, int key);

'key' will match  up  with  the  number  that  the  call  to  resolve()
returned.   'address'  will  be  the  domain  name  of  the  host,  and
'resolved' the dotted decimal ip address.  The unknown value will be  0
if the lookup failed.

NOTE

When the 'this_player in call_out' driver setting is enabled,
this_player() inside the callback is preserved from the time the
request was made, like call_out().

SEE ALSO

query_host_name(3),  socket_address(3), query_ip_name(3), query_ip_num
ber(3)