免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2353 | 回复: 7
打印 上一主题 下一主题

[FastDFS] storage_fun.c修改 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-21 10:44 |只看该作者 |倒序浏览
从1065行开始

#ifdef WITH_HTTPD
                {
                char *pHttpTrunkSize;
                int64_t http_trunk_size;

                if ((result=fdfs_http_params_load(&iniContext, \
                                filename, &g_http_params)) != 0)
                {
                        break;
                }

                               if(g_http_params.server_port > 0 )
                                               g_http_port = g_http_params.server_port;

                pHttpDomain = iniGetStrValue(NULL, \
                        "http.domain_name", &iniContext);
                if (pHttpDomain == NULL)
                {
                        *g_http_domain = '\0';
                }
                else
                {
                        snprintf(g_http_domain, sizeof(g_http_domain), \
                                "%s", pHttpDomain);
                }

论坛徽章:
0
2 [报告]
发表于 2010-05-22 18:09 |只看该作者
感觉是需要修改啊,即使在编译屏蔽 WITH_HTTPD时,程序中有好几处都会读取http port 和http.domain_name
斑竹,有空答疑一下么

论坛徽章:
0
3 [报告]
发表于 2010-05-22 18:12 |只看该作者

论坛徽章:
4
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:56:11IT运维版块每日发帖之星
日期:2016-08-11 06:20:00IT运维版块每日发帖之星
日期:2016-08-15 06:20:00
4 [报告]
发表于 2010-05-22 21:55 |只看该作者
感觉是需要修改啊,即使在编译屏蔽 WITH_HTTPD时,程序中有好几处都会读取http port 和http.domain_name
斑 ...
liuxy 发表于 2010-05-22 18:09


是会读取,但不会要求一定要配置这两个参数啊。
storage server上可以安装nginx等其他web server,和tracker server内置的HTTP server配合使用。

论坛徽章:
0
5 [报告]
发表于 2010-05-24 16:27 |只看该作者
斑竹,文件ni_file_reader.c中下函数应增加strlen(pValue)的检测,不然为空也不会返回nDefaultValue的


int iniGetIntValue(const char *szSectionName, const char *szItemName, \
                IniContext *pContext, const int nDefaultValue)
{
        char *pValue;

        pValue = iniGetStrValue(szSectionName, szItemName, pContext);
        if (pValue != NULL && strlen(pValue)>0)
        {
                return atoi(pValue);
        }
       
  return nDefaultValue;
}

论坛徽章:
0
6 [报告]
发表于 2010-05-24 16:56 |只看该作者
验证了一下,其中:
iniGetDoubleValue
iniGetInt64Value
都存在这样的问题

论坛徽章:
4
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:56:11IT运维版块每日发帖之星
日期:2016-08-11 06:20:00IT运维版块每日发帖之星
日期:2016-08-15 06:20:00
7 [报告]
发表于 2010-05-25 12:30 |只看该作者
斑竹,文件ni_file_reader.c中下函数应增加strlen(pValue)的检测,不然为空也不会返回nDefaultValue的


...
liuxy 发表于 2010-05-24 16:27


目前的设计是这样的:只有当配置项不存在时,才会返回缺省值。
配置项存在,但值为空,不会返回缺省值。

论坛徽章:
0
8 [报告]
发表于 2010-05-25 13:16 |只看该作者
哦,谢谢斑竹答疑,这段时间在努力的学习:wink:
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP