ngx_http分析

ngx_http 依赖于ngx_config.h以及ngx_core.h


先分析ngx_config.h

#define ngx_align(d, a) (((d) + (a - 1)) & ~(a - 1))

意思是把d变成a的若干倍, 分析如下, 假设a 为64


1. d+(a-1) > a

2. ~(a-1) 即把a的低位全部变为0

3. a & ~(a-1) 结果就是把a的地位全部变为0

最后的结果就是 x>=a的位数全部保留了下来,这样的话,其实就是取了a的整数倍













----------------------------------------分割线-----------------------------------------

接下来准备去做LCD、IGBT、HMI方面的电商


static ngx_int_t ngx_http_flv_live_init(ngx_conf_t *cf) { ngx_str_t *value; ngx_array_t a; ngx_http_handler_pt *h; ngx_http_flv_live_fmt_t *fmt; ngx_http_flv_live_main_conf_t *lmcf; ngx_http_core_main_conf_t *cmcf; lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_flv_live_module); if (lmcf->combined_used) { if (ngx_array_init(&a, cf->pool, 1, sizeof(ngx_str_t)) != NGX_OK) { return NGX_ERROR; } value = ngx_array_push(&a); if (value == NULL) { return NGX_ERROR; } *value = ngx_http_combined_fmt; fmt = lmcf->formats.elts; if (ngx_http_flv_live_compile_format(cf, NULL, fmt->ops, &a, 0) != NGX_CONF_OK) { return NGX_ERROR; } } cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); h = ngx_array_push(&cmcf->phases[NGX_HTTP_LOG_PHASE].handlers); if (h == NULL) { return NGX_ERROR; } *h = ngx_http_flv_live_handler; ngx_http_next_body_filter = ngx_http_top_body_filter; ngx_http_top_body_filter = ngx_http_flv_parser_body_filter; return NGX_OK; } static ngx_http_module_t ngx_http_flv_live_module_ctx = { NULL, /* preconfiguration */ ngx_http_flv_live_init, /* postconfiguration */ ngx_http_flv_live_create_main_conf, /* create main configuration */ NULL, /* init main configuration */ NULL, /* create server configuration */ NULL, /* merge server configuration */ ngx_http_flv_live_create_loc_conf, /* create location configuration */ ngx_http_flv_live_merge_loc_conf /* merge location configuration */ }; ngx_module_t ngx_http_flv_live_module = { NGX_MODULE_V1, &ngx_http_flv_live_module_ctx, /* module context */ ngx_http_flv_live_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ NULL, /* init thread */ NULL, /* exit thread */ NULL, /* exit process */ NULL, /* exit master */ NGX_MODULE_V1_PADDING };
最新发布
08-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值