Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

added marco ngx_tcp_cycle_get_module_main_conf #86

Merged
merged 1 commit into from

2 participants

Xiaochen Wang Weibin Yao(姚伟斌)
Xiaochen Wang

If developer writes a tcp module and defines ngx_module_t:init_module field,
this macro will be useful to get main conf of his tcp module from cycle.

struct nginx_module_s {
  ...
  ngx_int_t (*init_module)(ngx_cycle_t *cycle);
  ...
}

Note that http module has a similar macro (ngx_http_cycle_get_module_main_conf).

Xiaochen Wang chobits added marco ngx_tcp_cycle_get_module_main_conf
If developer writes a tcp module and defines ngx_module_t:init_module field,
this macro will be useful to get main conf of his tcp module from cycle.

    nginx_module_t {
      ngx_int_t (*init_module)(ngx_cycle_t *cycle);
    }

Note that http module has a similar macro (ngx_http_cycle_get_module_main_conf).
fdaaa08
Weibin Yao(姚伟斌)
Owner

LGTM

Weibin Yao(姚伟斌) yaoweibin merged commit 776a6a5 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 24, 2014
  1. Xiaochen Wang

    added marco ngx_tcp_cycle_get_module_main_conf

    chobits authored
    If developer writes a tcp module and defines ngx_module_t:init_module field,
    this macro will be useful to get main conf of his tcp module from cycle.
    
        nginx_module_t {
          ngx_int_t (*init_module)(ngx_cycle_t *cycle);
        }
    
    Note that http module has a similar macro (ngx_http_cycle_get_module_main_conf).
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 ngx_tcp.h
6 ngx_tcp.h
View
@@ -271,8 +271,14 @@ typedef struct {
#define ngx_tcp_conf_get_module_srv_conf(cf, module) \
((ngx_tcp_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index]
+#define ngx_tcp_cycle_get_module_main_conf(cycle, module) \
+ (cycle->conf_ctx[ngx_tcp_module.index] ? \
+ ((ngx_tcp_conf_ctx_t *) cycle->conf_ctx[ngx_tcp_module.index]) \
+ ->main_conf[module.ctx_index]: \
+ NULL)
extern ngx_uint_t ngx_tcp_max_module;
extern ngx_module_t ngx_tcp_core_module;
+extern ngx_module_t ngx_tcp_module;
#endif /* _NGX_TCP_H_INCLUDED_ */
Something went wrong with that request. Please try again.