Retrieve and store the hostname only once so multiple threads do not potentially initialize it at the same time.

........

Merged revisions 400245 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400246 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/97/197/1
Joshua Colp 12 years ago
parent 7d17d5fb04
commit c33aac75e4

@ -48,6 +48,9 @@
#define MOD_DATA_ON_RESPONSE "on_response"
#define MOD_DATA_NAT_HOOK "nat_hook"
/* Hostname used for origin line within SDP */
static const pj_str_t *hostname;
/* Some forward declarations */
static void handle_incoming_request(struct ast_sip_session *session, pjsip_rx_data *rdata);
static void handle_incoming_response(struct ast_sip_session *session, pjsip_rx_data *rdata);
@ -1991,7 +1994,7 @@ static struct pjmedia_sdp_session *create_local_sdp(pjsip_inv_session *inv, stru
pj_strdup2(inv->pool, &local->origin.user, session->endpoint->media.sdpowner);
local->origin.net_type = STR_IN;
local->origin.addr_type = session->endpoint->media.rtp.ipv6 ? STR_IP6 : STR_IP4;
local->origin.addr = *pj_gethostname();
local->origin.addr = *hostname;
pj_strdup2(inv->pool, &local->name, session->endpoint->media.sdpsession);
/* Now let the handlers add streams of various types, pjmedia will automatically reorder the media streams for us */
@ -2137,6 +2140,7 @@ static int load_module(void)
pjsip_inv_usage_init(endpt, &inv_callback);
pjsip_100rel_init_module(endpt);
pjsip_timer_init_module(endpt);
hostname = pj_gethostname();
if (ast_sip_register_service(&session_module)) {
return AST_MODULE_LOAD_DECLINE;
}

Loading…
Cancel
Save