Skip to content

Commit a8094df

Browse files
committed
added clientid to notifications & control
1 parent 8d9f99b commit a8094df

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

ngx_rtmp_control_module.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static const char *
259259
ngx_rtmp_control_walk_session(ngx_http_request_t *r,
260260
ngx_rtmp_live_ctx_t *lctx)
261261
{
262-
ngx_str_t addr, *paddr;
262+
ngx_str_t addr, *paddr, clientid;
263263
ngx_rtmp_session_t *s, **ss;
264264
ngx_rtmp_control_ctx_t *ctx;
265265

@@ -280,6 +280,17 @@ ngx_rtmp_control_walk_session(ngx_http_request_t *r,
280280
}
281281
}
282282

283+
if (ngx_http_arg(r, (u_char *) "clientid", sizeof("clientid") - 1,
284+
&clientid)
285+
== NGX_OK)
286+
{
287+
if (s->connection->number !=
288+
(ngx_uint_t) ngx_atoi(clientid.data, clientid.len))
289+
{
290+
return NGX_CONF_OK;
291+
}
292+
}
293+
283294
ctx = ngx_http_get_module_ctx(r, ngx_rtmp_control_module);
284295

285296
switch (ctx->filter) {

ngx_rtmp_netcall_module.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ ngx_rtmp_netcall_http_format_session(ngx_rtmp_session_t *s, ngx_pool_t *pool)
585585
sizeof("&swfurl=") - 1 + s->swf_url.len * 3 +
586586
sizeof("&tcurl=") - 1 + s->tc_url.len * 3 +
587587
sizeof("&pageurl=") - 1 + s->page_url.len * 3 +
588-
sizeof("&addr=") - 1 + addr_text->len * 3
588+
sizeof("&addr=") - 1 + addr_text->len * 3 +
589+
sizeof("&clientid=") - 1 + NGX_INT_T_LEN
589590
);
590591

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

622-
b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") -1);
623+
b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") - 1);
623624
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
624625
addr_text->len, NGX_ESCAPE_ARGS);
625626

627+
b->last = ngx_cpymem(b->last, (u_char*) "&clientid=",
628+
sizeof("&clientid=") - 1);
629+
b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->connection->number);
630+
626631
return cl;
627632
}
628633

0 commit comments

Comments
 (0)