...
Code Block | ||||
---|---|---|---|---|
| ||||
EdmiError edmiRemoteTerminateClient(SdaiServerContext serverContextId,
SdaiString password,
SdaiClientId clientId,
SdaiOptions options,
SdaiInvocationId *edmiInvocationId);
|
Disconnects a thick EDMclient connection from an EDMServer
...
For various reasons, such as system maintenance, it may be necessary to disconnect one or all connected EDMclients from an EDMserver
...
. When disconnecting an EDMclient from an EDM Server, you must give the superusers password.
The client may be terminated in two ways. Either by telling the client to disconnect the next time it sends a request to the EDM Server, or by simply killing the connection and leave it to the client to sort out any problems.
...
To prevent the clients from reconnecting, use edmiRemoteSetUnavailable .
...
Arguments
...
Type | Name | Comment |
SdaiServerContext | serverContextId | Context identification, from edmiDefineServerContext |
SdaiString | password | The password of the EDMuser superuser. If the superuser is defined in the server context, this argument may be omitted. |
SdaiClientId | clientId | The client Id of the connection to terminate. |
SdaiOptions | options | See description of available options below. |
SdaiInvocationId | edmiInvocationId | Currently not used. |
Return Value
...
Insert excerpt |
---|
|
Options
...
Option | Comment |
KILL_CLIENT | Disconnect the client immediately. Ongoing tasks will be aborted and rolled back. The client will receive the error message edmiE_STOPPED. |
FORCE_TO_TERMINATE | Tell the thick EDMclient to disconnect the next time it sends a request to the EDM Server. Ongoing tasks will be alloved allowed to complete. any succeeding requests will result in the error message edmiE_FORCE_DISCONNECT |
Returns:
A completion code of datatype EdmiError is the returned function value. The completion code has the following values:
Completion code = 0 : Operation successfully performed.
Completion code != 0: Error in operation. Completion code is an _EDMinterface_ error code. Use edmiGetErrorText to get the error text corresponding to the error code.
Example:
int i;
EdmiError rstat;
SdaiServerContext suContext;
tEdmiWhoIsOnServer *pWhoIsOn;
tEdmiConnection *pConnect;
SdaiInteger nConnect;
/* Define Remote Server Context
for the superuser */
rstat =
Example
...
Code Block | ||
---|---|---|
| ||
int i; EdmiError rstat; SdaiServerContext suContext; tEdmiWhoIsOnServer *pWhoIsOn; tEdmiConnection *pConnect; SdaiInteger nConnect; /* Define Remote Server Context for the superuser */ rstat = edmiDefineServerContext("SuperUserContext", |
...
"superuser", NULL, "xfx56kl9", |
...
"TCP", "9090", "MyServerHost", |
...
NULL, NULL, NULL, NULL, NULL, &suContext); |
...
/* Set system unavailable */ |
...
rstat = edmiRemoteSetUnavailable(suContext, |
...
"System unavailable due to maintenance", |
...
NULL, NULL); |
...
/* Kill all the thick EDMclients except for those |
...
connected as superuser. Do not kill any of |
...
the EDMapplicationServer processes. Other |
...
superuser connections shall be forced to terminate. */ rstat = edmiRemoteWhoIsOn(suContext, &nConnect, &pWhoIsOn, NULL); |
...
pConnect = pWhoIsOn->connections; |
...
for (i=0;i<nConnect;i++) { |
...
SdaiString _hostName, _clientName, _userName; |
...
/* Do not kill your own client connection */ |
...
if (pConnect->clientId != pWhoIsOn->myClientId) { |
...
rstat = edmiRemoteGetClientNames(suContext, |
...
pConnect->clientId, &_hostName, |
...
&_clientName, NULL); |
...
/* Do not kill EDMapplicationServer processes */ |
...
if (!strstr(_clientName, "EDMapplicationServer-")) { |
...
rstat = edmiRemoteGetAttrs(suContext, |
...
pConnect->userId, 0, 1, NULL, |
...
"NAME", sdaiSTRING, &_userName); |
...
/* Check if superuser owns connection */ |
...
if (strcmp(_userName, "superuser")) { |
...
/* No mercy!! Kill any |
...
connection not owned by the superuser */ rstat = edmiRemoteTerminateClient(suContext, NULL, |
...
pConnect->clientId, KILL_CLIENT, NULL); |
...
} else { |
...
/* Handle superuser clients with care, |
...
i.e force them to terminate */ |
...
rstat = edmiRemoteTerminateClient(suContext, NULL, |
...
pConnect->clientId, FORCE_TO_TERMINATE, |
...
NULL); |
...
} } } ++pConnect; |
...
}
. . . |
See also
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|