[mod_kazoo] use globals hostname to create nodename in create_ei_cnode
This commit is contained in:
parent
1435577eaf
commit
ac77de715b
|
@ -345,10 +345,9 @@ switch_socket_t *create_socket(switch_memory_pool_t *pool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei_cnode_s *ei_cnode) {
|
switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei_cnode_s *ei_cnode) {
|
||||||
char hostname[EI_MAXHOSTNAMELEN + 1] = "";
|
char hostname[EI_MAXHOSTNAMELEN + 1];
|
||||||
char nodename[MAXNODELEN + 1];
|
char nodename[MAXNODELEN + 1];
|
||||||
char cnodename[EI_MAXALIVELEN + 1];
|
char cnodename[EI_MAXALIVELEN + 1];
|
||||||
//EI_MAX_COOKIE_SIZE+1
|
|
||||||
char *atsign;
|
char *atsign;
|
||||||
|
|
||||||
/* copy the erlang interface nodename into something we can modify */
|
/* copy the erlang interface nodename into something we can modify */
|
||||||
|
@ -356,17 +355,13 @@ switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei
|
||||||
|
|
||||||
if ((atsign = strchr(cnodename, '@'))) {
|
if ((atsign = strchr(cnodename, '@'))) {
|
||||||
/* we got a qualified node name, don't guess the host/domain */
|
/* we got a qualified node name, don't guess the host/domain */
|
||||||
snprintf(nodename, MAXNODELEN + 1, "%s", kazoo_globals.ei_nodename);
|
snprintf(nodename, MAXNODELEN + 1, "%s", name);
|
||||||
/* truncate the alivename at the @ */
|
/* truncate the alivename at the @ */
|
||||||
*atsign = '\0';
|
*atsign++ = '\0';
|
||||||
|
strncpy(hostname, atsign, EI_MAXHOSTNAMELEN);
|
||||||
} else {
|
} else {
|
||||||
if (zstr(kazoo_globals.hostname) || !strncasecmp(kazoo_globals.ip, "0.0.0.0", 7) || !strncasecmp(kazoo_globals.ip, "::", 2)) {
|
strncpy(hostname, kazoo_globals.hostname, EI_MAXHOSTNAMELEN);
|
||||||
memcpy(hostname, switch_core_get_hostname(), EI_MAXHOSTNAMELEN);
|
snprintf(nodename, MAXNODELEN + 1, "%s@%s", name, hostname);
|
||||||
} else {
|
|
||||||
memcpy(hostname, kazoo_globals.hostname, EI_MAXHOSTNAMELEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(nodename, MAXNODELEN + 1, "%s@%s", kazoo_globals.ei_nodename, hostname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kazoo_globals.ei_shortname) {
|
if (kazoo_globals.ei_shortname) {
|
||||||
|
@ -376,6 +371,8 @@ switch_status_t create_ei_cnode(const char *ip_addr, const char *name, struct ei
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "creating nodename: %s\n", nodename);
|
||||||
|
|
||||||
/* init the ec stuff */
|
/* init the ec stuff */
|
||||||
if (ei_connect_xinit(ei_cnode, hostname, cnodename, nodename, (Erl_IpAddr) ip_addr, kazoo_globals.ei_cookie, 0) < 0) {
|
if (ei_connect_xinit(ei_cnode, hostname, cnodename, nodename, (Erl_IpAddr) ip_addr, kazoo_globals.ei_cookie, 0) < 0) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to initialize the erlang interface connection structure\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to initialize the erlang interface connection structure\n");
|
||||||
|
|
Loading…
Reference in New Issue