allow netsock objects to be unref'd so they can disappear when needed (issue #5454)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6913 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming 2005-10-31 23:16:27 +00:00
parent d8672874ef
commit e86e9a9fe3
3 changed files with 9 additions and 0 deletions

View File

@ -8640,6 +8640,7 @@ static int set_config(char *config_file, int reload)
}
if (defaultsockfd < 0)
defaultsockfd = ast_netsock_sockfd(ns);
ast_netsock_unref(ns);
}
}
} else if (!strcasecmp(v->name, "authdebug"))
@ -9568,6 +9569,7 @@ int load_module(void)
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Binding IAX2 to default address 0.0.0.0:%d\n", IAX_DEFAULT_PORTNO);
defaultsockfd = ast_netsock_sockfd(ns);
ast_netsock_unref(ns);
}
}

View File

@ -59,6 +59,8 @@ const struct sockaddr_in *ast_netsock_boundaddr(const struct ast_netsock *ns);
void *ast_netsock_data(const struct ast_netsock *ns);
void ast_netsock_unref(struct ast_netsock *ns);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif

View File

@ -214,3 +214,8 @@ void *ast_netsock_data(const struct ast_netsock *ns)
{
return ns->data;
}
void ast_netsock_unref(struct ast_netsock *ns)
{
ASTOBJ_UNREF(ns, ast_netsock_destroy);
}