#include "configd.h"
#include "session.h"
#include "notify.h"
boolean_t
notify_server(mach_msg_header_t *request, mach_msg_header_t *reply)
{
mach_no_senders_notification_t *notify = (mach_no_senders_notification_t *)request;
if ((notify->not_header.msgh_id > MACH_NOTIFY_LAST) ||
(notify->not_header.msgh_id < MACH_NOTIFY_FIRST)) {
return FALSE;
}
switch (notify->not_header.msgh_id) {
case MACH_NOTIFY_NO_SENDERS :
SCLog(_configd_verbose, LOG_DEBUG, CFSTR("No more senders for port %d, closing."),
notify->not_header.msgh_local_port);
cleanupSession(notify->not_header.msgh_local_port);
(void) mach_port_destroy(mach_task_self(), notify->not_header.msgh_local_port);
notify->not_header.msgh_remote_port = MACH_PORT_NULL;
return TRUE;
case MACH_NOTIFY_DEAD_NAME :
SCLog(_configd_verbose, LOG_DEBUG, CFSTR("Dead name for port %d, closing."),
notify->not_header.msgh_local_port);
cleanupSession(notify->not_header.msgh_local_port);
(void) mach_port_destroy(mach_task_self(), notify->not_header.msgh_local_port);
notify->not_header.msgh_remote_port = MACH_PORT_NULL;
return TRUE;
default :
break;
}
SCLog(_configd_verbose, LOG_DEBUG, CFSTR("HELP!, Received notification: port=%d, msgh_id=%d"),
notify->not_header.msgh_local_port,
notify->not_header.msgh_id);
return FALSE;
}