mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
Formatting changes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@277102 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -88,8 +88,9 @@ struct ast_dnsmgr_entry *ast_dnsmgr_get(const char *name, struct ast_sockaddr *r
|
|||||||
struct ast_dnsmgr_entry *entry;
|
struct ast_dnsmgr_entry *entry;
|
||||||
int total_size = sizeof(*entry) + strlen(name) + (service ? strlen(service) + 1 : 0);
|
int total_size = sizeof(*entry) + strlen(name) + (service ? strlen(service) + 1 : 0);
|
||||||
|
|
||||||
if (!result || ast_strlen_zero(name) || !(entry = ast_calloc(1, total_size)))
|
if (!result || ast_strlen_zero(name) || !(entry = ast_calloc(1, total_size))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
entry->result = result;
|
entry->result = result;
|
||||||
ast_mutex_init(&entry->lock);
|
ast_mutex_init(&entry->lock);
|
||||||
@@ -122,11 +123,13 @@ void ast_dnsmgr_release(struct ast_dnsmgr_entry *entry)
|
|||||||
|
|
||||||
int ast_dnsmgr_lookup(const char *name, struct ast_sockaddr *result, struct ast_dnsmgr_entry **dnsmgr, const char *service)
|
int ast_dnsmgr_lookup(const char *name, struct ast_sockaddr *result, struct ast_dnsmgr_entry **dnsmgr, const char *service)
|
||||||
{
|
{
|
||||||
if (ast_strlen_zero(name) || !result || !dnsmgr)
|
if (ast_strlen_zero(name) || !result || !dnsmgr) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (*dnsmgr && !strcasecmp((*dnsmgr)->name, name))
|
if (*dnsmgr && !strcasecmp((*dnsmgr)->name, name)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ast_verb(4, "doing dnsmgr_lookup for '%s'\n", name);
|
ast_verb(4, "doing dnsmgr_lookup for '%s'\n", name);
|
||||||
|
|
||||||
@@ -134,8 +137,9 @@ int ast_dnsmgr_lookup(const char *name, struct ast_sockaddr *result, struct ast_
|
|||||||
ast_get_ip_or_srv(result, name, service);
|
ast_get_ip_or_srv(result, name, service);
|
||||||
|
|
||||||
/* if dnsmgr is not enable don't bother adding an entry */
|
/* if dnsmgr is not enable don't bother adding an entry */
|
||||||
if (!enabled)
|
if (!enabled) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ast_verb(3, "adding dns manager for '%s'\n", name);
|
ast_verb(3, "adding dns manager for '%s'\n", name);
|
||||||
*dnsmgr = ast_dnsmgr_get(name, result, service);
|
*dnsmgr = ast_dnsmgr_get(name, result, service);
|
||||||
|
13
main/srv.c
13
main/srv.c
@@ -248,6 +248,7 @@ void ast_srv_cleanup(struct srv_context **context)
|
|||||||
{
|
{
|
||||||
const char *host;
|
const char *host;
|
||||||
unsigned short port;
|
unsigned short port;
|
||||||
|
|
||||||
while (!(ast_srv_lookup(context, NULL, &host, &port)));
|
while (!(ast_srv_lookup(context, NULL, &host, &port)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,16 +258,19 @@ int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, co
|
|||||||
struct srv_entry *current;
|
struct srv_entry *current;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (chan && ast_autoservice_start(chan) < 0)
|
if (chan && ast_autoservice_start(chan) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ret = ast_search_dns(&context, service, C_IN, T_SRV, srv_callback);
|
ret = ast_search_dns(&context, service, C_IN, T_SRV, srv_callback);
|
||||||
|
|
||||||
if (context.have_weights)
|
if (context.have_weights) {
|
||||||
process_weights(&context);
|
process_weights(&context);
|
||||||
|
}
|
||||||
|
|
||||||
if (chan)
|
if (chan) {
|
||||||
ret |= ast_autoservice_stop(chan);
|
ret |= ast_autoservice_stop(chan);
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: there could be a "." entry in the returned list of
|
/* TODO: there could be a "." entry in the returned list of
|
||||||
answers... if so, this requires special handling */
|
answers... if so, this requires special handling */
|
||||||
@@ -285,8 +289,9 @@ int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, co
|
|||||||
*port = -1;
|
*port = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((current = AST_LIST_REMOVE_HEAD(&context.entries, list)))
|
while ((current = AST_LIST_REMOVE_HEAD(&context.entries, list))) {
|
||||||
ast_free(current);
|
ast_free(current);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user