mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 08:11:21 +00:00
netsock2: Add ast_sockaddr_resolve_first_af to netsock2 public API
This function originally was used in chan_sip to enable some simplifying assumptions and eventually was copy and pasted into res_pjsip_logger and res_hep. Since it's replicated in three places, it's probably best to move it into the public netsock2 API for these modules to use. Change-Id: Id52e23be885601c51d70259f62de1a5e59d38d04
This commit is contained in:
@@ -367,27 +367,6 @@ static void hepv3_data_dtor(void *obj)
|
||||
}
|
||||
}
|
||||
|
||||
/*! \brief Pulls first resolved address and returns it */
|
||||
static int ast_sockaddr_resolve_first_af(struct ast_sockaddr *addr,
|
||||
const char* name, int flag, int family)
|
||||
{
|
||||
struct ast_sockaddr *addrs;
|
||||
int addrs_cnt;
|
||||
|
||||
addrs_cnt = ast_sockaddr_resolve(&addrs, name, flag, family);
|
||||
if (addrs_cnt <= 0) {
|
||||
return 1;
|
||||
}
|
||||
if (addrs_cnt > 1) {
|
||||
ast_debug(1, "Multiple addresses resolving %s, using the first one only\n", name);
|
||||
}
|
||||
|
||||
ast_sockaddr_copy(addr, &addrs[0]);
|
||||
|
||||
ast_free(addrs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*! \brief Allocate the HEPv3 run-time data */
|
||||
static struct hepv3_runtime_data *hepv3_data_alloc(struct hepv3_global_config *config)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user