From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,e096a424ab6d3dc6,start X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-09-17 16:53:19 PST Newsgroups: comp.unix.osf.misc Path: gmd.de!newsserver.jvnc.net!howland.reston.ans.net!vixen.cso.uiuc.edu!sdd.hp.com!hpscit.sc.hp.com!hplextra!hplntx!thuan From: thuan@hpltp.hpl.hp.com (Thuan Q. Pham) Subject: Re: [DCE] unexporting/unregistering servers Sender: news@hplntx.hpl.hp.com (HPL News Posting Service) Message-ID: In-Reply-To: scooper@cse.ucsc.edu's message of 17 Sep 1993 19:58:54 GMT Date: Fri, 17 Sep 1993 23:12:04 GMT References: <27d4tuINNdcq@darkstar.UCSC.EDU> Nntp-Posting-Host: hpltp.hpl.hp.com Organization: Hewlett-Packard Laboratories, Palo Alto, CA In article <27d4tuINNdcq@darkstar.UCSC.EDU> scooper@cse.ucsc.edu (Scott Cooper) writes: > I have some simple RPC clients and servers which do not behave > properly if the server is killed. What is the proper procedure to go > through to unregister a server interface, unexport its bindings, and > unregister its endpoints? I have been unable to decipher the > DCE documentation on this point. If you want to do clean up (which we should), call the unexport routines. These are very similar to the export routines you call when you set the server up: quitServer() { rpc_ep_unregister() /* clean up the local endpoint mapper */ rpc_ns_binding_unexport() /* unregister the interface from name space */ rpc_binding_vector_free() /* if you still have binding vectors around */ } etc.. etc.. There are other functions to call (such as group unexport, the nsa_***(), etc.. ). But he rule of thumb is that you should undo what you did. Look at what call you make to register stuff and simply call the ones to unregister them. > We are talking about the simplest possible client/server > relationship here: no UUIDs, only one interface exported per server, etc. > I would eventually like to provide for the following things: > 1) The server should unregister itself if it is killed. 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). >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. >3) Some kind of manager program should be able to shut down the server. Same as 2), I don't see much difference here. > Clues on any or all of the above are greatly appreciated - > I really need to get past this snag to get on with a stub compiler > that I am building. Hope it works for you. Works for me so far.... /Thuan ------------------------------------------------------------------- Thuan Q. Pham Hewlett-Packard Laboratories (415) 857-6818 1501 Page Mill Road pham@hpl.hp.com Palo Alto, Ca 94303