Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
nginx-push-stream-module
Commits
636f84ba
Commit
636f84ba
authored
Mar 11, 2011
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change signature of ngx_http_push_stream_send_response_chunk method to simplify the use
parent
49ac6540
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
17 deletions
+12
-17
ngx_http_push_stream_module_utils.h
include/ngx_http_push_stream_module_utils.h
+1
-1
ngx_http_push_stream_module.c
src/ngx_http_push_stream_module.c
+2
-2
ngx_http_push_stream_module_ipc.c
src/ngx_http_push_stream_module_ipc.c
+4
-6
ngx_http_push_stream_module_subscriber.c
src/ngx_http_push_stream_module_subscriber.c
+1
-4
ngx_http_push_stream_module_utils.c
src/ngx_http_push_stream_module_utils.c
+4
-4
No files found.
include/ngx_http_push_stream_module_utils.h
View file @
636f84ba
...
@@ -151,7 +151,7 @@ static ngx_int_t ngx_http_push_stream_send_only_header_response(ngx_h
...
@@ -151,7 +151,7 @@ static ngx_int_t ngx_http_push_stream_send_only_header_response(ngx_h
static
u_char
*
ngx_http_push_stream_str_replace
(
u_char
*
org
,
u_char
*
find
,
u_char
*
replace
,
ngx_pool_t
*
temp_pool
);
static
u_char
*
ngx_http_push_stream_str_replace
(
u_char
*
org
,
u_char
*
find
,
u_char
*
replace
,
ngx_pool_t
*
temp_pool
);
static
ngx_buf_t
*
ngx_http_push_stream_get_formatted_message
(
ngx_http_push_stream_loc_conf_t
*
pslcf
,
ngx_http_push_stream_channel_t
*
channel
,
ngx_buf_t
*
buf
,
ngx_pool_t
*
temp_pool
);
static
ngx_buf_t
*
ngx_http_push_stream_get_formatted_message
(
ngx_http_push_stream_loc_conf_t
*
pslcf
,
ngx_http_push_stream_channel_t
*
channel
,
ngx_buf_t
*
buf
,
ngx_pool_t
*
temp_pool
);
static
ngx_int_t
ngx_http_push_stream_send_response_content_header
(
ngx_http_request_t
*
r
,
ngx_http_push_stream_loc_conf_t
*
pslcf
);
static
ngx_int_t
ngx_http_push_stream_send_response_content_header
(
ngx_http_request_t
*
r
,
ngx_http_push_stream_loc_conf_t
*
pslcf
);
static
ngx_int_t
ngx_http_push_stream_send_response_chunk
(
ngx_http_request_t
*
r
,
const
ngx_str_t
*
chunk_text
,
ngx_flag_t
last_buffer
);
static
ngx_int_t
ngx_http_push_stream_send_response_chunk
(
ngx_http_request_t
*
r
,
const
u_char
*
chunk_text
,
uint
chunk_len
,
ngx_flag_t
last_buffer
);
static
ngx_int_t
ngx_http_push_stream_send_ping
(
ngx_log_t
*
log
,
ngx_http_push_stream_loc_conf_t
*
pslcf
);
static
ngx_int_t
ngx_http_push_stream_send_ping
(
ngx_log_t
*
log
,
ngx_http_push_stream_loc_conf_t
*
pslcf
);
static
ngx_int_t
ngx_http_push_stream_memory_cleanup
(
ngx_log_t
*
log
,
ngx_http_push_stream_loc_conf_t
*
pslcf
);
static
ngx_int_t
ngx_http_push_stream_memory_cleanup
(
ngx_log_t
*
log
,
ngx_http_push_stream_loc_conf_t
*
pslcf
);
...
...
src/ngx_http_push_stream_module.c
View file @
636f84ba
...
@@ -232,7 +232,7 @@ ngx_http_push_stream_send_response_all_channels_info_detailed(ngx_http_request_t
...
@@ -232,7 +232,7 @@ ngx_http_push_stream_send_response_all_channels_info_detailed(ngx_http_request_t
ngx_sprintf
(
header_response
.
data
,
(
char
*
)
head
->
data
,
hostname
->
data
,
currenttime
->
data
,
shm_data
->
channels
,
shm_data
->
broadcast_channels
);
ngx_sprintf
(
header_response
.
data
,
(
char
*
)
head
->
data
,
hostname
->
data
,
currenttime
->
data
,
shm_data
->
channels
,
shm_data
->
broadcast_channels
);
header_response
.
len
=
ngx_strlen
(
header_response
.
data
);
header_response
.
len
=
ngx_strlen
(
header_response
.
data
);
ngx_http_push_stream_send_response_chunk
(
r
,
&
header_response
,
0
);
ngx_http_push_stream_send_response_chunk
(
r
,
header_response
.
data
,
header_response
.
len
,
0
);
// send content body
// send content body
cur
=
ngx_queue_head
(
&
queue_channel_info
);
cur
=
ngx_queue_head
(
&
queue_channel_info
);
...
@@ -257,7 +257,7 @@ ngx_http_push_stream_send_response_all_channels_info_detailed(ngx_http_request_t
...
@@ -257,7 +257,7 @@ ngx_http_push_stream_send_response_all_channels_info_detailed(ngx_http_request_t
r
->
keepalive
=
0
;
r
->
keepalive
=
0
;
// send content tail
// send content tail
ngx_http_push_stream_send_response_chunk
(
r
,
tail
,
1
);
ngx_http_push_stream_send_response_chunk
(
r
,
tail
->
data
,
tail
->
len
,
1
);
return
NGX_DONE
;
return
NGX_DONE
;
}
}
src/ngx_http_push_stream_module_ipc.c
View file @
636f84ba
...
@@ -263,11 +263,10 @@ ngx_http_push_stream_send_worker_ping_message(void)
...
@@ -263,11 +263,10 @@ ngx_http_push_stream_send_worker_ping_message(void)
ngx_http_push_stream_worker_subscriber_t
*
cur
=
sentinel
;
ngx_http_push_stream_worker_subscriber_t
*
cur
=
sentinel
;
if
((
ngx_http_push_stream_ping_buf
!=
NULL
)
&&
(
!
ngx_queue_empty
(
&
sentinel
->
queue
)))
{
if
((
ngx_http_push_stream_ping_buf
!=
NULL
)
&&
(
!
ngx_queue_empty
(
&
sentinel
->
queue
)))
{
ngx_str_t
aux
=
ngx_string
(
ngx_http_push_stream_ping_buf
->
pos
);
uint
len
=
ngx_buf_size
(
ngx_http_push_stream_ping_buf
);
aux
.
len
=
ngx_buf_size
(
ngx_http_push_stream_ping_buf
);
while
((
cur
=
(
ngx_http_push_stream_worker_subscriber_t
*
)
ngx_queue_next
(
&
cur
->
queue
))
!=
sentinel
)
{
while
((
cur
=
(
ngx_http_push_stream_worker_subscriber_t
*
)
ngx_queue_next
(
&
cur
->
queue
))
!=
sentinel
)
{
if
(
cur
->
request
!=
NULL
)
{
if
(
cur
->
request
!=
NULL
)
{
ngx_http_push_stream_send_response_chunk
(
cur
->
request
,
&
aux
,
0
);
ngx_http_push_stream_send_response_chunk
(
cur
->
request
,
ngx_http_push_stream_ping_buf
->
pos
,
len
,
0
);
}
}
}
}
}
}
...
@@ -385,12 +384,11 @@ ngx_http_push_stream_respond_to_subscribers(ngx_http_push_stream_channel_t *chan
...
@@ -385,12 +384,11 @@ ngx_http_push_stream_respond_to_subscribers(ngx_http_push_stream_channel_t *chan
cur
=
sentinel
;
cur
=
sentinel
;
if
(
msg
!=
NULL
)
{
if
(
msg
!=
NULL
)
{
ngx_str_t
message
=
ngx_string
(
msg
->
buf
->
pos
);
uint
len
=
ngx_buf_size
(
msg
->
buf
);
message
.
len
=
ngx_buf_size
(
msg
->
buf
);
// now let's respond to some requests!
// now let's respond to some requests!
while
((
cur
=
(
ngx_http_push_stream_subscriber_t
*
)
ngx_queue_next
(
&
cur
->
queue
))
!=
sentinel
)
{
while
((
cur
=
(
ngx_http_push_stream_subscriber_t
*
)
ngx_queue_next
(
&
cur
->
queue
))
!=
sentinel
)
{
ngx_http_push_stream_send_response_chunk
(
cur
->
request
,
&
message
,
0
);
ngx_http_push_stream_send_response_chunk
(
cur
->
request
,
msg
->
buf
->
pos
,
len
,
0
);
}
}
}
}
...
...
src/ngx_http_push_stream_module_subscriber.c
View file @
636f84ba
...
@@ -240,10 +240,7 @@ ngx_http_push_stream_subscriber_assign_channel(ngx_slab_pool_t *shpool, ngx_http
...
@@ -240,10 +240,7 @@ ngx_http_push_stream_subscriber_assign_channel(ngx_slab_pool_t *shpool, ngx_http
// positioning at first message, and send the others
// positioning at first message, and send the others
while
((
qtd
>
0
)
&&
(
!
message
->
deleted
)
&&
((
message
=
(
ngx_http_push_stream_msg_t
*
)
ngx_queue_next
(
&
message
->
queue
))
!=
message_sentinel
))
{
while
((
qtd
>
0
)
&&
(
!
message
->
deleted
)
&&
((
message
=
(
ngx_http_push_stream_msg_t
*
)
ngx_queue_next
(
&
message
->
queue
))
!=
message_sentinel
))
{
if
(
start
==
0
)
{
if
(
start
==
0
)
{
ngx_str_t
msg
=
ngx_string
(
message
->
buf
->
pos
);
ngx_http_push_stream_send_response_chunk
(
r
,
message
->
buf
->
pos
,
ngx_buf_size
(
message
->
buf
),
0
);
msg
.
len
=
ngx_buf_size
(
message
->
buf
);
ngx_http_push_stream_send_response_chunk
(
r
,
&
msg
,
0
);
qtd
--
;
qtd
--
;
}
else
{
}
else
{
...
...
src/ngx_http_push_stream_module_utils.c
View file @
636f84ba
...
@@ -112,14 +112,14 @@ ngx_http_push_stream_send_response_content_header(ngx_http_request_t *r, ngx_htt
...
@@ -112,14 +112,14 @@ ngx_http_push_stream_send_response_content_header(ngx_http_request_t *r, ngx_htt
ngx_int_t
rc
=
NGX_OK
;
ngx_int_t
rc
=
NGX_OK
;
if
(
pslcf
->
header_template
.
len
>
0
)
{
if
(
pslcf
->
header_template
.
len
>
0
)
{
rc
=
ngx_http_push_stream_send_response_chunk
(
r
,
&
pslcf
->
header_template
,
0
);
rc
=
ngx_http_push_stream_send_response_chunk
(
r
,
pslcf
->
header_template
.
data
,
pslcf
->
header_template
.
len
,
0
);
}
}
return
rc
;
return
rc
;
}
}
static
ngx_int_t
static
ngx_int_t
ngx_http_push_stream_send_response_chunk
(
ngx_http_request_t
*
r
,
const
ngx_str_t
*
chunk_text
,
ngx_flag_t
las_buffer
)
ngx_http_push_stream_send_response_chunk
(
ngx_http_request_t
*
r
,
const
u_char
*
chunk_text
,
uint
chunk_len
,
ngx_flag_t
las_buffer
)
{
{
ngx_buf_t
*
b
;
ngx_buf_t
*
b
;
ngx_chain_t
*
out
;
ngx_chain_t
*
out
;
...
@@ -137,9 +137,9 @@ ngx_http_push_stream_send_response_chunk(ngx_http_request_t *r, const ngx_str_t
...
@@ -137,9 +137,9 @@ ngx_http_push_stream_send_response_chunk(ngx_http_request_t *r, const ngx_str_t
b
->
last_buf
=
las_buffer
;
b
->
last_buf
=
las_buffer
;
b
->
flush
=
1
;
b
->
flush
=
1
;
b
->
memory
=
1
;
b
->
memory
=
1
;
b
->
pos
=
chunk_text
->
data
;
b
->
pos
=
(
u_char
*
)
chunk_text
;
b
->
start
=
b
->
pos
;
b
->
start
=
b
->
pos
;
b
->
end
=
b
->
pos
+
chunk_
text
->
len
;
b
->
end
=
b
->
pos
+
chunk_len
;
b
->
last
=
b
->
end
;
b
->
last
=
b
->
end
;
out
->
buf
=
b
;
out
->
buf
=
b
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment