Skip to content

Commit

Permalink
[fix] fix the winshining#85 bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
winshining committed Feb 1, 2019
1 parent f6d0461 commit 5e1a6b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 8 additions & 0 deletions ngx_rtmp_netcall_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ typedef struct ngx_rtmp_netcall_session_s {


typedef struct {
ngx_uint_t nb_cs;
ngx_rtmp_netcall_session_t *cs;
} ngx_rtmp_netcall_ctx_t;

Expand Down Expand Up @@ -198,6 +199,11 @@ ngx_rtmp_netcall_create(ngx_rtmp_session_t *s, ngx_rtmp_netcall_init_t *ci)
return NGX_ERROR;
}
ngx_rtmp_set_ctx(s, ctx, ngx_rtmp_netcall_module);
} else {
/* I don't know why? But it works! */
if (ctx->nb_cs == 0) {
ctx->cs = NULL;
}
}

/* Create netcall pool, connection, session.
Expand Down Expand Up @@ -271,6 +277,7 @@ ngx_rtmp_netcall_create(ngx_rtmp_session_t *s, ngx_rtmp_netcall_init_t *ci)
if (!cs->detached) {
cs->next = ctx->cs;
ctx->cs = cs;
ctx->nb_cs++;
}

ngx_rtmp_netcall_send(cc->write);
Expand Down Expand Up @@ -318,6 +325,7 @@ ngx_rtmp_netcall_close(ngx_connection_t *cc)
for(css = &ctx->cs; *css; css = &((*css)->next)) {
if (*css == cs) {
*css = cs->next;
ctx->nb_cs--;
break;
}
}
Expand Down
6 changes: 2 additions & 4 deletions ngx_rtmp_notify_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,14 +1173,12 @@ ngx_rtmp_notify_update_handle(ngx_rtmp_session_t *s,
static void
ngx_rtmp_notify_update(ngx_event_t *e)
{
ngx_connection_t *c;
ngx_rtmp_session_t *s;
ngx_rtmp_notify_app_conf_t *nacf;
ngx_rtmp_netcall_init_t ci;
ngx_url_t *url;

c = e->data;
s = c->data;
s = e->data;

nacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_notify_module);

Expand Down Expand Up @@ -1249,7 +1247,7 @@ ngx_rtmp_notify_init(ngx_rtmp_session_t *s,

e = &ctx->update_evt;

e->data = s->connection;
e->data = s;
e->log = s->connection->log;
e->handler = ngx_rtmp_notify_update;

Expand Down

0 comments on commit 5e1a6b6

Please sign in to comment.