diff --git a/bin_interface.c b/bin_interface.c index dc68bcdfa2..7da75bdf82 100644 --- a/bin_interface.c +++ b/bin_interface.c @@ -25,6 +25,7 @@ #include "bin_interface.h" #include "udp_server.h" #include "config.h" +#include "daemonize.h" #include "pt.h" struct socket_info *bin; @@ -434,6 +435,14 @@ int start_bin_receivers(void) bin->sock_str.s); bind_address = bin; + if (init_child(PROC_BIN) < 0) { + LM_ERR("init_child failed for BIN listener\n"); + if (send_status_code(-1) < 0) + LM_ERR("failed to send status code\n"); + clean_write_pipeend(); + exit(-1); + } + bin_receive_loop(); exit(-1); } else diff --git a/sr_module.c b/sr_module.c index 15bec0598d..9ddedb4797 100644 --- a/sr_module.c +++ b/sr_module.c @@ -425,6 +425,7 @@ int init_child(int rank) case PROC_TIMER: type = "PROC_TIMER"; break; case PROC_MODULE: type = "PROC_MODULE"; break; case PROC_TCP_MAIN: type = "PROC_TCP_MAIN"; break; + case PROC_BIN: type = "PROC_BIN"; break; } if (!type) { diff --git a/sr_module.h b/sr_module.h index 4a7f88634d..5152eeba08 100644 --- a/sr_module.h +++ b/sr_module.h @@ -82,6 +82,7 @@ typedef int (*mod_proc_wrapper)(); #define PROC_TIMER -1 /* Timer attendant process */ #define PROC_MODULE -2 /* Extra process requested by modules */ #define PROC_TCP_MAIN -4 /* TCP main process */ +#define PROC_BIN -8 /* Any binary interface listener */ #define DEFAULT_DLFLAGS 0 /* value that signals to module loader to use default dlopen flags in opensips */