Skip to content

Commit

Permalink
added clientid to notifications & control
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Jan 16, 2014
1 parent 8d9f99b commit a8094df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 12 additions & 1 deletion ngx_rtmp_control_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static const char *
ngx_rtmp_control_walk_session(ngx_http_request_t *r,
ngx_rtmp_live_ctx_t *lctx)
{
ngx_str_t addr, *paddr;
ngx_str_t addr, *paddr, clientid;
ngx_rtmp_session_t *s, **ss;
ngx_rtmp_control_ctx_t *ctx;

Expand All @@ -280,6 +280,17 @@ ngx_rtmp_control_walk_session(ngx_http_request_t *r,
}
}

if (ngx_http_arg(r, (u_char *) "clientid", sizeof("clientid") - 1,
&clientid)
== NGX_OK)
{
if (s->connection->number !=
(ngx_uint_t) ngx_atoi(clientid.data, clientid.len))
{
return NGX_CONF_OK;
}
}

ctx = ngx_http_get_module_ctx(r, ngx_rtmp_control_module);

switch (ctx->filter) {
Expand Down
9 changes: 7 additions & 2 deletions ngx_rtmp_netcall_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
sizeof("&swfurl=") - 1 + s->swf_url.len * 3 +
sizeof("&tcurl=") - 1 + s->tc_url.len * 3 +
sizeof("&pageurl=") - 1 + s->page_url.len * 3 +
sizeof("&addr=") - 1 + addr_text->len * 3
sizeof("&addr=") - 1 + addr_text->len * 3 +
sizeof("&clientid=") - 1 + NGX_INT_T_LEN
);

if (b == NULL) {
Expand Down Expand Up @@ -619,10 +620,14 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
b->last = (u_char*) ngx_escape_uri(b->last, s->page_url.data,
s->page_url.len, NGX_ESCAPE_ARGS);

b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") -1);
b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") - 1);
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
addr_text->len, NGX_ESCAPE_ARGS);

b->last = ngx_cpymem(b->last, (u_char*) "&clientid=",
sizeof("&clientid=") - 1);
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->connection->number);

return cl;
}

Expand Down

0 comments on commit a8094df

Please sign in to comment.