|
@@ -67,8 +67,16 @@ int myco_daemon_register_agent(message msg) {
|
|
|
|
|
|
int myco_daemon_unregister_agent(message msg) {
|
|
|
myco_agent *current_agent;
|
|
|
+ myco_resource *current_resource;
|
|
|
+
|
|
|
+ current_agent = myco_daemon_find_agent(msg.agent_name);
|
|
|
+
|
|
|
+ if ((current_resource = myco_daemon_find_resource_by_agent(msg.agent_name)) != NULL) {
|
|
|
+ sprintf(msg.message, "ERROR: agent %s still has resource %s\n", msg.agent_name, current_resource->name);
|
|
|
+ myco_send(msg.agent_message_queue_id, msg);
|
|
|
|
|
|
- current_agent= myco_daemon_find_agent(msg.agent_name);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
|
|
|
if (current_agent == NULL) {
|
|
|
sprintf(msg.message, "ERROR: agent %s could not be unregistered\n", msg.agent_name);
|