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
6e0e7946
Commit
6e0e7946
authored
May 20, 2011
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
double check if channel is available
parent
87170726
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
26 deletions
+19
-26
ngx_http_push_stream_module_utils.h
include/ngx_http_push_stream_module_utils.h
+2
-2
ngx_http_push_stream_module_setup.c
src/ngx_http_push_stream_module_setup.c
+1
-1
ngx_http_push_stream_module_utils.c
src/ngx_http_push_stream_module_utils.c
+16
-23
No files found.
include/ngx_http_push_stream_module_utils.h
View file @
6e0e7946
...
...
@@ -221,8 +221,8 @@ static void ngx_http_push_stream_timer_reset(ngx_msec_t timer_in
static
void
ngx_http_push_stream_worker_subscriber_cleanup
(
ngx_http_push_stream_worker_subscriber_t
*
worker_subscriber
);
u_char
*
ngx_http_push_stream_append_crlf
(
const
ngx_str_t
*
str
,
ngx_pool_t
*
pool
);
static
void
ngx_http_push_stream_collect_expired_messages
(
ngx_
rbtree_t
*
tree
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
);
static
void
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
ngx_
rbtree_t
*
tree
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
);
static
void
ngx_http_push_stream_collect_expired_messages
(
ngx_
http_push_stream_shm_data_t
*
data
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
);
static
void
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
ngx_
http_push_stream_shm_data_t
*
data
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
);
static
ngx_int_t
ngx_http_push_stream_free_memory_of_expired_messages_and_channels
(
ngx_flag_t
force
);
static
ngx_inline
void
ngx_http_push_stream_ensure_qtd_of_messages_locked
(
ngx_http_push_stream_channel_t
*
channel
,
ngx_uint_t
max_messages
,
ngx_flag_t
expired
);
...
...
src/ngx_http_push_stream_module_setup.c
View file @
6e0e7946
...
...
@@ -210,7 +210,7 @@ ngx_http_push_stream_exit_master(ngx_cycle_t *cycle)
ngx_slab_pool_t
*
shpool
=
(
ngx_slab_pool_t
*
)
ngx_http_push_stream_shm_zone
->
shm
.
addr
;
// destroy channel tree in shared memory
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
&
data
->
tree
,
shpool
,
data
->
tree
.
root
,
1
);
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
data
,
shpool
,
data
->
tree
.
root
,
1
);
ngx_http_push_stream_free_memory_of_expired_messages_and_channels
(
1
);
}
...
...
src/ngx_http_push_stream_module_utils.c
View file @
6e0e7946
...
...
@@ -186,28 +186,24 @@ ngx_http_push_stream_send_ping(ngx_log_t *log, ngx_http_push_stream_loc_conf_t *
static
void
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
ngx_
rbtree_t
*
tree
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
)
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
ngx_
http_push_stream_shm_data_t
*
data
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
)
{
ngx_http_push_stream_shm_data_t
*
data
=
(
ngx_http_push_stream_shm_data_t
*
)
ngx_http_push_stream_shm_zone
->
data
;
ngx_rbtree_node_t
*
sentinel
;
ngx_http_push_stream_channel_t
*
channel
;
sentinel
=
tree
->
sentinel
;
channel
=
(
ngx_http_push_stream_channel_t
*
)
node
;
if
((
!
channel
->
deleted
)
&&
(
&
channel
->
node
!=
sentinel
))
{
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
)
&&
(
&
channel
->
node
!=
data
->
tree
.
sentinel
)
&&
(
&
channel
->
node
!=
data
->
channels_to_delete
.
sentinel
))
{
if
((
!
channel
->
deleted
)
&&
(
channel
->
node
.
left
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
tree
,
shpool
,
node
->
left
,
force
);
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
)
&&
(
channel
->
node
.
left
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
data
,
shpool
,
node
->
left
,
force
);
}
if
((
!
channel
->
deleted
)
&&
(
channel
->
node
.
right
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
tree
,
shpool
,
node
->
right
,
force
);
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
)
&&
(
channel
->
node
.
right
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
data
,
shpool
,
node
->
right
,
force
);
}
ngx_shmtx_lock
(
&
shpool
->
mutex
);
if
((
channel
!=
NULL
)
&&
(
!
channel
->
deleted
))
{
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
))
{
ngx_http_push_stream_ensure_qtd_of_messages_locked
(
channel
,
(
force
)
?
0
:
channel
->
stored_messages
,
1
);
...
...
@@ -229,27 +225,24 @@ ngx_http_push_stream_collect_expired_messages_and_empty_channels(ngx_rbtree_t *t
static
void
ngx_http_push_stream_collect_expired_messages
(
ngx_
rbtree_t
*
tree
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
)
ngx_http_push_stream_collect_expired_messages
(
ngx_
http_push_stream_shm_data_t
*
data
,
ngx_slab_pool_t
*
shpool
,
ngx_rbtree_node_t
*
node
,
ngx_flag_t
force
)
{
ngx_rbtree_node_t
*
sentinel
;
ngx_http_push_stream_channel_t
*
channel
;
sentinel
=
tree
->
sentinel
;
channel
=
(
ngx_http_push_stream_channel_t
*
)
node
;
if
((
!
channel
->
deleted
)
&&
(
&
channel
->
node
!=
sentinel
))
{
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
)
&&
(
&
channel
->
node
!=
data
->
tree
.
sentinel
)
&&
(
&
channel
->
node
!=
data
->
channels_to_delete
.
sentinel
))
{
if
((
!
channel
->
deleted
)
&&
(
channel
->
node
.
left
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages
(
tree
,
shpool
,
node
->
left
,
force
);
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
)
&&
(
channel
->
node
.
left
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages
(
data
,
shpool
,
node
->
left
,
force
);
}
if
((
!
channel
->
deleted
)
&&
(
channel
->
node
.
right
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages
(
tree
,
shpool
,
node
->
right
,
force
);
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
)
&&
(
channel
->
node
.
right
!=
NULL
))
{
ngx_http_push_stream_collect_expired_messages
(
data
,
shpool
,
node
->
right
,
force
);
}
ngx_shmtx_lock
(
&
shpool
->
mutex
);
if
((
channel
!=
NULL
)
&&
(
!
channel
->
deleted
))
{
if
((
channel
!=
NULL
)
&&
(
channel
->
deleted
==
0
))
{
ngx_http_push_stream_ensure_qtd_of_messages_locked
(
channel
,
(
force
)
?
0
:
channel
->
stored_messages
,
1
);
}
...
...
@@ -307,7 +300,7 @@ ngx_http_push_stream_memory_cleanup(ngx_log_t *log, ngx_http_push_stream_main_co
ngx_slab_pool_t
*
shpool
=
(
ngx_slab_pool_t
*
)
ngx_http_push_stream_shm_zone
->
shm
.
addr
;
ngx_http_push_stream_shm_data_t
*
data
=
(
ngx_http_push_stream_shm_data_t
*
)
ngx_http_push_stream_shm_zone
->
data
;
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
&
data
->
tree
,
shpool
,
data
->
tree
.
root
,
0
);
ngx_http_push_stream_collect_expired_messages_and_empty_channels
(
data
,
shpool
,
data
->
tree
.
root
,
0
);
ngx_http_push_stream_free_memory_of_expired_messages_and_channels
(
0
);
return
NGX_OK
;
...
...
@@ -320,7 +313,7 @@ ngx_http_push_stream_buffer_cleanup(ngx_log_t *log, ngx_http_push_stream_loc_con
ngx_slab_pool_t
*
shpool
=
(
ngx_slab_pool_t
*
)
ngx_http_push_stream_shm_zone
->
shm
.
addr
;
ngx_http_push_stream_shm_data_t
*
data
=
(
ngx_http_push_stream_shm_data_t
*
)
ngx_http_push_stream_shm_zone
->
data
;
ngx_http_push_stream_collect_expired_messages
(
&
data
->
tree
,
shpool
,
data
->
tree
.
root
,
0
);
ngx_http_push_stream_collect_expired_messages
(
data
,
shpool
,
data
->
tree
.
root
,
0
);
return
NGX_OK
;
}
...
...
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