* Pinging DCE Servers
@ 1993-05-03 16:23 Jeffrey L. DeMent
1993-05-04 22:12 ` David Skeen
1993-05-05 19:56 ` Greg Brail
0 siblings, 2 replies; 3+ messages in thread
From: Jeffrey L. DeMent @ 1993-05-03 16:23 UTC (permalink / raw)
Is there a generally accepted methodology for overcoming the problem of
invalid (stale, whatever you want to call them) handles in CDS ? Since
entries in CDS tend to stay there forever, it's entirely possible for
CDS to return an invalid binding handle in response to a client request.
Below is some code (error checking and other stuff removed) I tried that
did not work ..... someone out there have a scheme that works ?
rpc_ns_binding_import_begin(rpc_c_ns_syntax_default,
(unsigned_char_t *) argv[1],
greetif_v1_0_c_ifspec,
NULL,
&import_context,
&status);
while(1) {
rpc_ns_binding_import_next(import_context, &h, &status);
rpc_ep_resolve_binding(h, greetif_v1_0_c_ifspec, &status);
rpc_mgmt_is_server_listening(h, &status);
if(status != rpc_s_ok) continue;
/*
* PROBLEM IS rpc_mgmt....() call returns 0 even when
* server not there !
*/
rpc_ns_binding_import_done(&import_context, &status);
break;
}
/* Make the remote call */
Thanks.
Jeff
_____________________________________________________________________
Jeffrey L. DeMent _._._._._._._
U S WEST Advanced Technologies (_|_|_|_|_|_|_)
1475 Lawrence Street, Suite 400 ` \` | | '/ '
Denver, Colorado 80202 ` \`| |'/ '
` \| |/ '
Phone: (303) 595-0519 ` \0/ '
FAX: (303) 592-6532 `~#~'
^
Internet: jld@advtech.uswest.com
_____________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Pinging DCE Servers
1993-05-03 16:23 Pinging DCE Servers Jeffrey L. DeMent
@ 1993-05-04 22:12 ` David Skeen
1993-05-05 19:56 ` Greg Brail
1 sibling, 0 replies; 3+ messages in thread
From: David Skeen @ 1993-05-04 22:12 UTC (permalink / raw)
One solution I've seen: try the rpc_ns_binding_import_begin/next/done
loop; if you didn't get a valid binding handle, use
rpc_ns_mgmt_handle_set_exp_age(h, 0, *st) to bypass the CDS cache,
then retry the rpc_ns_binding_import_begin/next/done loop. In the
normal case, you expect a cache hit; for stale cache data, you go the
slower route to access a CDS server.
--
Dave Skeen
A32/B901 Zip 9132 Internet: dls@austin.ibm.com
Austin, TX 78758 IBM VNET: SKEEN at AUSTIN
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Pinging DCE Servers
1993-05-03 16:23 Pinging DCE Servers Jeffrey L. DeMent
1993-05-04 22:12 ` David Skeen
@ 1993-05-05 19:56 ` Greg Brail
1 sibling, 0 replies; 3+ messages in thread
From: Greg Brail @ 1993-05-05 19:56 UTC (permalink / raw)
In article <C6GLJq.8uI@da_vinci.it.uswc.uswest.com> Jeffrey L. DeMent <jld@advtech.uswest.com> writes:
>Is there a generally accepted methodology for overcoming the problem of
>invalid (stale, whatever you want to call them) handles in CDS ? Since
>entries in CDS tend to stay there forever, it's entirely possible for
>CDS to return an invalid binding handle in response to a client request.
>Below is some code (error checking and other stuff removed) I tried that
>did not work ..... someone out there have a scheme that works ?
(Lots of code deleted...)
You're on the right track. However, rpc_mgmt_is_server_listening
RETURNS a boolean that will be "true" if the server's there and
"false" if not. The "status" parameter you pass (an unsigned32*) is
different. rpc_mgmt_is_server_listening may return false (meaning the
server is not listening), but the status parameter will still be set
to rpc_s_ok because the call completed successfully. So here you want
to check the return value from the function to see if the server is
listening, not the status variable.
No, this is not consistent with the rest of the DCE API, and it
screwed me up too until I figured it out.
But what's really confusing you here is the CDS client cache. Every
DCE node caches information it gets from the CDS server. That
information stays around for eight hours or until you tell your client
to refresh the cache. So if you stop and restart a server on another
machine, the CDS information under that name will be stale on your
client. This will be the case even if the server exited properly by
unregistering its entry from CDS.
So after getting a binding via rpc_ns_import_next or whatever, you
should call rpc_ep_resolve_binding like you do in your example, but
be sure to check the "status" parameter. The RPC endpoint mapper
automatically cleans up stale entries pretty quickly, so this
operation may fail.
If this succeeded, you should ping the server with rpc_mgmt_is_server
listening. If this succeeds, then you actually found a server.
If either of the last two operations failed, you should try the whole
thing again with the CDS client cache disabled. Use either the
rpc_ns_mgmt_set_exp_age or rpc_ns_mgmt_handle_set_exp_age function to
do this, and set the expiration age to 0. This will bypass the cache
and contact the CDS server directly. This is much less efficient, so
you should re-set the cache to a large value once you have a binding
to your server, or future CDS lookups will be slow.
This binding lookup process is slow, but it's the only way to ensure
you get a valid binding to the server.
greg
--
Greg Brail ------------------ Citibank -------------------- gjb@fig.citib.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-05-05 19:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-05-03 16:23 Pinging DCE Servers Jeffrey L. DeMent
1993-05-04 22:12 ` David Skeen
1993-05-05 19:56 ` Greg Brail
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox