Detect duplicate objects

Creating a monitor or a listener twice is now detected and the proper
error is printed.
This commit is contained in:
Markus Makela
2016-12-03 11:31:18 +02:00
parent be7a315614
commit 9df3f154cf
7 changed files with 71 additions and 39 deletions

View File

@ -1085,7 +1085,11 @@ static void createListener(DCB *dcb, SERVICE *service, char *name, char *address
static void createMonitor(DCB *dcb, const char *name, const char *module)
{
if (runtime_create_monitor(name, module))
if (monitor_find(name))
{
dcb_printf(dcb, "Monitor '%s' already exists\n", name);
}
else if (runtime_create_monitor(name, module))
{
dcb_printf(dcb, "Created monitor '%s'\n", name);
}