From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,e096a424ab6d3dc6 X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-09-20 09:24:05 PST Newsgroups: comp.unix.osf.misc Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!charon.citicorp.com!ibism!gjb From: gjb@fig.citib.com (Greg Brail) Subject: Re: [DCE] unexporting/unregistering servers Message-ID: Sender: news@fig.citib.com Organization: Citibank GCMS/FTN Development References: <27d4tuINNdcq@darkstar.UCSC.EDU> Date: Mon, 20 Sep 1993 16:00:20 GMT In article , Thuan Q. Pham wrote: > >In article <27d4tuINNdcq@darkstar.UCSC.EDU> scooper@cse.ucsc.edu (Scott Cooper) writes: >If you mean kill itself gracefully when you hit ^C, then you have to handle >the UNIX signals. To handle this (like control-C), we must start a thread >to handle the signal. Couldn't be done otherwise. The thread create a >signal mask, and actually block with a call to sigwait(). When a signal >is present, it unblocks, stops the server from accepting new calls, and >cause it to exit when the last existing rpc call is handled. (really >graceful exit). Then, it breaks the server-listen loop and start the clean >up routine. (Just register a signal handling routine by calling signal() >isn't good enough). Good explanation, but to clarify: Call that "quitServer" routine that Thuan described after your call to rpc_server_listen. In your signal handler, call rpc_mgmt_stop_server_listening with a binding handle parameter of NULL. This will make the server stop accepting RPCs and make rpc_server_listen return. >>2) Authorized clients should be able to indicate that the server should >>shut down > >Server should support a function that enable a client to call it and tell >it to kill itself. No need to bother if you don't feel like it. If you use rpc_mgmt_stop_server_listening in your signal handler like I described above, then any client can call it too once it has a binding to your server. However, your server must call rpc_mgmt_set_authorization_fn to register a callback that DCE will call whenever the client calls a management routine. By default, stop_server_listening calls from remote clients are rejected. Your callback must decide if the client is authorized, then return "TRUE" if it wants the shutdown request to be accepted. greg -- Greg Brail ------------------ Citibank -------------------- gjb@fig.citib.com