@@ -254,8 +254,8 @@ static http_parser_settings settings = {
254
254
.on_message_complete = 0
255
255
};
256
256
257
- ngx_atomic_t upsync_shared_created0 ;
258
- ngx_atomic_t * upsync_shared_created = & upsync_shared_created0 ;
257
+ ngx_atomic_t stream_upsync_shared_created0 ;
258
+ ngx_atomic_t * stream_upsync_shared_created = & stream_upsync_shared_created0 ;
259
259
260
260
static http_parser * parser = NULL ;
261
261
static ngx_stream_http_state state ;
@@ -1878,7 +1878,12 @@ ngx_stream_upsync_init_module(ngx_cycle_t *cycle)
1878
1878
ngx_uint_t i ;
1879
1879
ngx_stream_upsync_server_t * upsync_server ;
1880
1880
ngx_stream_upsync_srv_conf_t * upscf ;
1881
-
1881
+
1882
+ // no stream {} block found
1883
+ if (upsync_ctx == NULL ) {
1884
+ return NGX_OK ;
1885
+ }
1886
+
1882
1887
upsync_server = upsync_ctx -> upsync_server ;
1883
1888
1884
1889
if (ngx_stream_upsync_init_shm_mutex (cycle ) != NGX_OK ) {
@@ -1913,10 +1918,10 @@ ngx_stream_upsync_init_shm_mutex(ngx_cycle_t *cycle)
1913
1918
1914
1919
upsync_server = upsync_ctx -> upsync_server ;
1915
1920
1916
- if (* upsync_shared_created ) {
1917
- shm .size = 128 * (* upsync_shared_created );
1921
+ if (* stream_upsync_shared_created ) {
1922
+ shm .size = 128 * (* stream_upsync_shared_created );
1918
1923
shm .log = cycle -> log ;
1919
- shm .addr = (u_char * )(upsync_shared_created );
1924
+ shm .addr = (u_char * )(stream_upsync_shared_created );
1920
1925
shm .name .len = sizeof ("ngx_upsync_shared_zone" );
1921
1926
shm .name .data = (u_char * )"ngx_upsync_shared_zone" ;
1922
1927
@@ -1942,7 +1947,7 @@ ngx_stream_upsync_init_shm_mutex(ngx_cycle_t *cycle)
1942
1947
}
1943
1948
shared = shm .addr ;
1944
1949
1945
- upsync_shared_created = (ngx_atomic_t * )shared ;
1950
+ stream_upsync_shared_created = (ngx_atomic_t * )shared ;
1946
1951
1947
1952
for (i = 0 ; i < upsync_ctx -> upstream_num ; i ++ ) {
1948
1953
@@ -1970,7 +1975,7 @@ ngx_stream_upsync_init_shm_mutex(ngx_cycle_t *cycle)
1970
1975
}
1971
1976
}
1972
1977
1973
- ngx_atomic_cmp_set (upsync_shared_created , * upsync_shared_created ,
1978
+ ngx_atomic_cmp_set (stream_upsync_shared_created , * stream_upsync_shared_created ,
1974
1979
upsync_ctx -> upstream_num );
1975
1980
1976
1981
return NGX_OK ;
@@ -1988,6 +1993,10 @@ ngx_stream_upsync_init_process(ngx_cycle_t *cycle)
1988
1993
ngx_stream_upsync_ctx_t * ctx ;
1989
1994
ngx_stream_upsync_server_t * upsync_server ;
1990
1995
1996
+ // no stream {} block found
1997
+ if (upsync_ctx == NULL ) {
1998
+ return NGX_OK ;
1999
+ }
1991
2000
upsync_server = upsync_ctx -> upsync_server ;
1992
2001
1993
2002
for (i = 0 ; i < upsync_ctx -> upstream_num ; i ++ ) {
0 commit comments