when the server exits don't wait for stats from sec-mod

This commit is contained in:
Nikos Mavrogiannopoulos
2015-05-13 14:27:27 +02:00
parent 8829441e82
commit 8b6b83a6f6
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ inline static void terminate_proc(main_server_st *s, proc_st *proc)
if (proc->pid != -1 && proc->pid != 0)
kill(proc->pid, SIGTERM);
else
remove_proc(s, proc, 1);
remove_proc(s, proc, 1, 0);
}
#endif
+2 -2
View File
@@ -167,7 +167,7 @@ struct proc_st *ctmp;
/* k: whether to kill the process
*/
void remove_proc(main_server_st * s, struct proc_st *proc, unsigned k)
void remove_proc(main_server_st * s, struct proc_st *proc, unsigned k, unsigned quit)
{
mslog(s, proc, LOG_INFO, "user disconnected");
@@ -178,7 +178,7 @@ void remove_proc(main_server_st * s, struct proc_st *proc, unsigned k)
kill(proc->pid, SIGTERM);
/* close any pending sessions */
if (proc->active_sid) {
if (proc->active_sid && quit == 0) {
session_close(s, proc);
}
+3 -3
View File
@@ -500,7 +500,7 @@ struct script_wait_st *stmp = NULL, *spos;
list_del(&stmp->list);
ret = handle_script_exit(s, stmp->proc, estatus);
if (ret < 0) {
remove_proc(s, stmp->proc, 1);
remove_proc(s, stmp->proc, 1, 0);
} else {
talloc_free(stmp);
}
@@ -660,7 +660,7 @@ static void kill_children(main_server_st* s)
kill(s->sec_mod_pid, SIGTERM);
list_for_each_safe(&s->proc_list.head, ctmp, cpos, list) {
if (ctmp->pid != -1) {
remove_proc(s, ctmp, 1);
remove_proc(s, ctmp, 1, 1);
}
}
}
@@ -1267,7 +1267,7 @@ fork_failed:
if (ctmp->fd >= 0 && FD_ISSET(ctmp->fd, &rd_set)) {
ret = handle_commands(s, ctmp);
if (ret < 0) {
remove_proc(s, ctmp, (ret!=ERR_WORKER_TERMINATED)?1:0);
remove_proc(s, ctmp, (ret!=ERR_WORKER_TERMINATED)?1:0, 0);
}
}
}
+1 -1
View File
@@ -269,7 +269,7 @@ int run_sec_mod(main_server_st * s, int *sync_fd);
struct proc_st *new_proc(main_server_st * s, pid_t pid, int cmd_fd,
struct sockaddr_storage *remote_addr, socklen_t remote_addr_len,
uint8_t *sid, size_t sid_size);
void remove_proc(main_server_st* s, struct proc_st *proc, unsigned k);
void remove_proc(main_server_st* s, struct proc_st *proc, unsigned k, unsigned quit);
void proc_to_zombie(main_server_st* s, struct proc_st *proc);
void put_into_cgroup(main_server_st * s, const char* cgroup, pid_t pid);