Can't dbUnregisterServer() if stopped & no stop() method
Unregistration is allowed if we're still registering though. This allows for cases like rsrv, which doesn't have a stop method. However the semantics of restarting servers after they have been stopped hasn't been defined, and rsrv probably wouldn't work if you tried that anyway, so I'm not convinced this is useful.
This commit is contained in:
@@ -76,6 +76,12 @@ int dbUnregisterServer(dbServer *psrv)
|
||||
psrv->name);
|
||||
return -1;
|
||||
}
|
||||
if (state == stopped && psrv->stop == NULL) {
|
||||
fprintf(stderr, "dbUnregisterServer: '%s' has no stop() method.\n",
|
||||
psrv->name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ellDelete(&serverList, &psrv->node);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ MAIN(dbServerTest)
|
||||
char *theName = "The One";
|
||||
int status;
|
||||
|
||||
testPlan(18);
|
||||
testPlan(20);
|
||||
|
||||
/* Prove that we handle substring names properly */
|
||||
epicsEnvSet("EPICS_IOC_IGNORE_SERVERS", "none ones");
|
||||
@@ -137,6 +137,8 @@ MAIN(dbServerTest)
|
||||
|
||||
testDiag("Registering dbServer 'no-routines'");
|
||||
testOk(dbRegisterServer(&no_routines) == 0, "Registered 'no-routines'");
|
||||
testOk(dbUnregisterServer(&no_routines) == 0, "'no-routines' unreg'd");
|
||||
testOk(dbRegisterServer(&no_routines) == 0, "Re-registered 'no-routines'");
|
||||
|
||||
epicsEnvSet("EPICS_IOC_IGNORE_SERVERS", "disabled nonexistent");
|
||||
testDiag("Registering dbServer 'disabled'");
|
||||
@@ -156,8 +158,8 @@ MAIN(dbServerTest)
|
||||
|
||||
dbStopServers();
|
||||
testOk(oneState == STOP_CALLED, "dbStopServers");
|
||||
testOk(dbUnregisterServer(&toolate) != 0, "No unregistration if not reg'ed");
|
||||
testOk(dbUnregisterServer(&no_routines) == 0, "Unregistered 'no-routines'");
|
||||
testOk(dbUnregisterServer(&toolate) != 0, "No unreg' if not reg'ed");
|
||||
testOk(dbUnregisterServer(&no_routines) != 0, "No unreg' of 'no-routines'");
|
||||
|
||||
testDiag("Printing server report");
|
||||
dbsr(0);
|
||||
|
||||
Reference in New Issue
Block a user