- if (ret < 0) /* join has been destroyed */
- goto join_again;
- join = join->next;
- }
-
- debug_prefix = 0;
-
- /* process any message */
- debug_count++;
- debug_prefix = "message";
- while ((message = message_get()))
- {
- all_idle = 0;
- switch(message->flow)
- {
- case PORT_TO_EPOINT:
- debug_prefix = "msg port->epoint";
- epoint = find_epoint_id(message->id_to);
- if (epoint)
- {
- if (epoint->ep_app)
- {
- epoint->ep_app->ea_message_port(message->id_from, message->type, &message->param);
- } else
- {
- PDEBUG(DEBUG_MSG, "Warning: message %s from port %d to endpoint %d. endpoint doesn't have an application.\n", messages_txt[message->type], message->id_from, message->id_to);
- }
- } else
- {
- PDEBUG(DEBUG_MSG, "Warning: message %s from port %d to endpoint %d. endpoint doesn't exist anymore.\n", messages_txt[message->type], message->id_from, message->id_to);
- }
- break;
-
- case EPOINT_TO_JOIN:
- debug_prefix = "msg epoint->join";
- join = find_join_id(message->id_to);
- if (join)
- {
- join->message_epoint(message->id_from, message->type, &message->param);
- } else
- {
- PDEBUG(DEBUG_MSG, "Warning: message %s from endpoint %d to join %d. join doesn't exist anymore\n", messages_txt[message->type], message->id_from, message->id_to);
- }
- break;
-
- case JOIN_TO_EPOINT:
- debug_prefix = "msg join->epoint";
- epoint = find_epoint_id(message->id_to);
- if (epoint)
- {
- if (epoint->ep_app)
- {
- epoint->ep_app->ea_message_join(message->id_from, message->type, &message->param);
- } else
- {
- PDEBUG(DEBUG_MSG, "Warning: message %s from join %d to endpoint %d. endpoint doesn't have an application.\n", messages_txt[message->type], message->id_from, message->id_to);
- }
- } else
- {
- PDEBUG(DEBUG_MSG, "Warning: message %s from join %d to endpoint %d. endpoint doesn't exist anymore.\n", messages_txt[message->type], message->id_from, message->id_to);
- }
- break;
-
- case EPOINT_TO_PORT:
- debug_prefix = "msg epoint->port";
- port = find_port_id(message->id_to);
- if (port)
- {
- port->message_epoint(message->id_from, message->type, &message->param);
-BUDETECT
- } else
- {
- PDEBUG(DEBUG_MSG, "Warning: message %s from endpoint %d to port %d. port doesn't exist anymore\n", messages_txt[message->type], message->id_from, message->id_to);
- }
- break;
-
- default:
- PERROR("Message flow %d unknown.\n", message->flow);
- }
- message_free(message);
- debug_count++;
- debug_prefix = "message";
- }
-BUDETECT
-
- /* handle socket */
- if (admin_handle())
- all_idle = 0;
-BUDETECT
-
-#if 0
- /* check for child to exit (eliminate zombies) */
- if (waitpid(-1, NULL, WNOHANG) > 0)
- {
- PDEBUG(DEBUG_EPOINT, "a child process (created by endpoint) has exitted.\n");
- all_idle = 0;
- }