Sync upstream updates from github.com/winshining/nginx-http-flv-module
This commit is contained in:
1 parent
1be683b499
commit
20bbd5d297
16 files changed
+209
-76
No files matched your search
@@ -17,8 +17,8 @@ static ngx_rtmp_delete_stream_pt next_delete_stream;
|
||||
|
||||
static ngx_int_t ngx_rtmp_auto_push_init_process(ngx_cycle_t *cycle);
|
||||
static void ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle);
|
||||
static void * ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cf);
|
||||
static char * ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf);
|
||||
static void *ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cf);
|
||||
static char *ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf);
|
||||
#if (NGX_HAVE_UNIX_DOMAIN)
|
||||
static ngx_int_t ngx_rtmp_auto_push_publish(ngx_rtmp_session_t *s,
|
||||
ngx_rtmp_publish_t *v);
|
||||
@@ -366,40 +366,51 @@ ngx_rtmp_auto_push_exit_process(ngx_cycle_t *cycle)
|
||||
ls = cycle->listening.elts;
|
||||
|
||||
for (n = 0; n < cycle->listening.nelts; ++n, ++ls) {
|
||||
if ((ls->handler == ngx_rtmp_init_connection) &&
|
||||
(ls->sockaddr && ls->sockaddr->sa_family == AF_UNIX))
|
||||
if (ls->handler != ngx_rtmp_init_connection ||
|
||||
ls->sockaddr == NULL || ls->sockaddr->sa_family != AF_UNIX)
|
||||
{
|
||||
c = ls->connection;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c) {
|
||||
if (c->read->active) {
|
||||
if (!(ngx_event_flags & NGX_USE_IOCP_EVENT)) {
|
||||
c = ls->connection;
|
||||
|
||||
/*
|
||||
* delete the old accept events that were bound to
|
||||
* the old cycle read events array
|
||||
*/
|
||||
if (c) {
|
||||
if (c->read->active) {
|
||||
if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
|
||||
|
||||
ngx_del_event(c->read,
|
||||
NGX_READ_EVENT, NGX_CLOSE_EVENT);
|
||||
/*
|
||||
* it seems that Linux-2.6.x OpenVZ sends events
|
||||
* for closed shared listening sockets unless
|
||||
* the events was explicitly deleted
|
||||
*/
|
||||
|
||||
ngx_free_connection(c);
|
||||
ngx_del_event(c->read, NGX_READ_EVENT, 0);
|
||||
|
||||
c->fd = (ngx_socket_t) -1;
|
||||
}
|
||||
} else {
|
||||
ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
|
||||
}
|
||||
}
|
||||
|
||||
if (ngx_close_socket(ls->fd) == -1) {
|
||||
ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_socket_errno,
|
||||
ngx_close_socket_n "%V failed",
|
||||
&ls->addr_text);
|
||||
if (c->read->timer_set) {
|
||||
ngx_del_timer(c->read);
|
||||
}
|
||||
|
||||
ls->fd = (ngx_socket_t) -1;
|
||||
ngx_free_connection(c);
|
||||
|
||||
break;
|
||||
c->fd = (ngx_socket_t) -1;
|
||||
}
|
||||
|
||||
ngx_log_debug2(NGX_LOG_DEBUG_RTMP, cycle->log, 0,
|
||||
"close listening %V #%d ", &ls->addr_text, ls->fd);
|
||||
|
||||
if (ngx_close_socket(ls->fd) == -1) {
|
||||
ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_socket_errno,
|
||||
ngx_close_socket_n "%V failed", &ls->addr_text);
|
||||
}
|
||||
|
||||
ls->fd = (ngx_socket_t) -1;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
pid = ngx_getpid();
|
||||
@@ -434,6 +445,11 @@ ngx_rtmp_auto_push_create_conf(ngx_cycle_t *cycle)
|
||||
static char *
|
||||
ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf)
|
||||
{
|
||||
#if (NGX_HAVE_UNIX_DOMAIN)
|
||||
struct sockaddr_un saun;
|
||||
size_t len;
|
||||
u_char *p;
|
||||
#endif
|
||||
ngx_rtmp_auto_push_conf_t *apcf = conf;
|
||||
|
||||
ngx_conf_init_value(apcf->auto_push, 0);
|
||||
@@ -442,6 +458,24 @@ ngx_rtmp_auto_push_init_conf(ngx_cycle_t *cycle, void *conf)
|
||||
if (apcf->socket_dir.len == 0) {
|
||||
ngx_str_set(&apcf->socket_dir, "/tmp");
|
||||
}
|
||||
#if (NGX_HAVE_UNIX_DOMAIN)
|
||||
else {
|
||||
p = apcf->socket_dir.data + apcf->socket_dir.len - 1;
|
||||
|
||||
while ((p > apcf->socket_dir.data) && (*p == '/' || *p == '\\')) {
|
||||
*p-- = '\0';
|
||||
}
|
||||
|
||||
apcf->socket_dir.len = p + 1 - apcf->socket_dir.data;
|
||||
len = apcf->socket_dir.len + sizeof(NGX_RTMP_AUTO_PUSH_SOCKNAME);
|
||||
|
||||
if (len + 1 + NGX_INT_T_LEN >= sizeof(saun.sun_path)) {
|
||||
ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
|
||||
"auto_push: too long \"rtmp_socket_dir\" directive");
|
||||
return NGX_CONF_ERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return NGX_CONF_OK;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user