Skip to content

Commit

Permalink
Fix: also run child_init for bin listeners
Browse files Browse the repository at this point in the history
- bin listeners are now identified by the PROC_BIN rank
- this way, only the UDP listeners receive positive ranks
  • Loading branch information
liviuchircu committed Aug 27, 2013
1 parent f153a9a commit 389de52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin_interface.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sr_module.c
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions sr_module.h
Expand Up @@ -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 */
Expand Down

0 comments on commit 389de52

Please sign in to comment.