Guardian Programmer's Guide

Table Of Contents
Writing a Server Program
Guardian Programmer’s Guide 421922-014
22 - 7
Deleting a Requester From the Opener Table
When the Requester Closes the Server
When a requester process closes a server, the server receives a Close message
(system message -104). On receipt of this message, the server must delete the
corresponding entry from the opener table. It does this by finding the process handle
and file number in the opener table and then deleting the entry by writing -1 over each
word.
When a CPU or Network Connection Fails
To be able to delete an entry from the opener table when the CPU of an opener fails or
when the network connection between the requester and server fails, your server
process must do the following:
Call the MONITORCPUS procedure so that the server will receive CPU down
messages (system message -2) on $RECEIVE
Call the MONITORNET procedure so that the server will receive Remote CPU
down (system message -100) and Node Down (system message -110) messages
Check $RECEIVE periodically for receipt of the CPU down, Remote CPU down, or
Node down message
On receipt of a CPU down, Remote CPU down, or Node down message, scan the
opener table for openers that were running on the failed CPU
Delete the opener from the opener table
The following example performs these tasks. It uses the OPENER_LOST_ procedure
to check system messages for information about lost openers. It deletes openers from
the opener table if the received message is a processor down (system message -2),
Remote processor down (system message -100), or Node Down (system message -
110) message.:
!Check for processor down messages from all local processor
!modules:
CPU^MASK.:= -1;
CALL MONITORCPUS(CPU^MASK);
!Check for failure of a remote processor or a remote node, or
!for failure to communicate with the remote node:
CALL MONITORNET(1);
.
.
!Read from $RECEIVE:
CALL READX(RECV^NUM,BUFFER,BUFSIZE,COUNT^READ);
IF <> THEN
BEGIN
CALL FILE_GETINFO_(RECV^NUM,ERROR);
IF ERROR = 6 THEN !system message received
BEGIN
.