If your program is a subscribing client,
it is important that you handle EVM daemon disconnection correctly. EVM
daemon disconnection must not occur under normal operation, but
may occur in a system that is being tested or if a fault is encountered.
If the EVM daemon terminates, it is usually restarted automatically
within few seconds by the Essential Services Monitor daemon. For
more information, see esmd(1M).
Although you must always test the return code from functions
dealing with a connection, it is especially important to do so for
a subscribing client. This is because a subscribing client may spend
most of its time waiting for activity that depends on a proper connection.
If disconnected, your program drops out of its select() or EvmConnWait() call, and subsequent calls to EvmConnCheck() and EvmConnDispatch() returns failure status codes. If this happens, the program
must not return immediately to the select() or EvmConnWait() call, because that results in a CPU-bound loop. Instead, determine
whether the status code indicates a connection error and, if so, destroy
the connection using EvmConnDestroy() and then attempt to reconnect. If the initial attempt
to reconnect fails, continue to retry the connection periodically
until it is re-established. The recommended retry interval is once
per second for the first 60 seconds, and every five seconds thereafter,
until the connection is restored, because the daemon usually restarts
automatically following any failure.
 |
 |  |
 |
 | NOTE: Not all error codes returned by the connection functions
indicate a disconnect. |
 |
 |  |
 |
In particular, the program can drop out of EvmConnWait() as a result of a signal. If this is indicated, the correct
action is to return immediately to the EvmConnWait() call.
If your program is a posting client,
you must deal with a disconnection only if you are using a permanent
connection. For more information about connection, see “Choosing a Connection
Policy”. You must be
sure to examine the return status from EvmEventPost() or EvmEventPostVa(), and, if necessary, re-establish the connection and retry
the post operation.