资源简介
fastdfs 5.05 版本
代码片段和文件信息
/**
* Copyright (C) 2008 Happy Fish / YuQing
*
* FastDFS may be copied only under the terms of the GNU General
* Public License V3 which may be found in the FastDFS source kit.
* Please visit the FastDFS Home Page http://www.csource.org/ for more detail.
**/
//client_func.c
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include “fdfs_define.h“
#include “logger.h“
#include “fdfs_global.h“
#include “base64.h“
#include “sockopt.h“
#include “shared_func.h“
#include “ini_file_reader.h“
#include “connection_pool.h“
#include “tracker_types.h“
#include “tracker_proto.h“
#include “client_global.h“
#include “client_func.h“
static int storage_cmp_by_ip_and_port(const void *p1 const void *p2)
{
int res;
res = strcmp(((ConnectionInfo *)p1)->ip_addr \
((ConnectionInfo *)p2)->ip_addr);
if (res != 0)
{
return res;
}
return ((ConnectionInfo *)p1)->port - \
((ConnectionInfo *)p2)->port;
}
static void insert_into_sorted_servers(TrackerServerGroup *pTrackerGroup \
ConnectionInfo *pInsertedServer)
{
ConnectionInfo *pDestServer;
for (pDestServer=pTrackerGroup->servers+pTrackerGroup->server_count; \
pDestServer>pTrackerGroup->servers; pDestServer--)
{
if (storage_cmp_by_ip_and_port(pInsertedServer \
pDestServer-1) > 0)
{
memcpy(pDestServer pInsertedServer \
sizeof(ConnectionInfo));
return;
}
memcpy(pDestServer pDestServer-1 sizeof(ConnectionInfo));
}
memcpy(pDestServer pInsertedServer sizeof(ConnectionInfo));
}
static int copy_tracker_servers(TrackerServerGroup *pTrackerGroup \
const char *filename char **ppTrackerServers)
{
char **ppSrc;
char **ppEnd;
ConnectionInfo destServer;
char *pSeperator;
char szHost[128];
int nHostLen;
memset(&destServer 0 sizeof(ConnectionInfo));
destServer.sock = -1;
ppEnd = ppTrackerServers + pTrackerGroup->server_count;
pTrackerGroup->server_count = 0;
for (ppSrc=ppTrackerServers; ppSrc {
if ((pSeperator=strchr(*ppSrc ‘:‘)) == NULL)
{
logError(“file: “__FILE__“ line: %d “ \
“conf file \“%s\“ “ \
“tracker_server \“%s\“ is invalid “ \
“correct format is host:port“ \
__LINE__ filename *ppSrc);
return EINVAL;
}
nHostLen = pSeperator - (*ppSrc);
if (nHostLen >= sizeof(szHost))
{
nHostLen = sizeof(szHost) - 1;
}
memcpy(szHost *ppSrc nHostLen);
szHost[nHostLen] = ‘\0‘;
if (getIpaddrByName(szHost destServer.ip_addr \
sizeof(destServer.ip_addr)) == INADDR_NONE)
{
logError(“file: “__FILE__“ line: %d “ \
“conf file \“%s\“ “ \
“host \“%s\“ is invalid“ \
__LINE__ filename szHost);
return EINVAL;
}
destServer.port = atoi(pSeperator+1);
if (destServer.port <= 0)
{
destServer.port = FDFS_TRACKER_SERVER_DEF_PORT;
}
if (bsearch(&destServer pTrackerGroup->servers \
pTrackerGroup->server_co
- 上一篇:proteus仿真红外发射接收
- 下一篇:linux加密perl 脚本工具
相关资源
- CCS5.05.1可使用的license
- HAP_Advanced_PDF_Password_Recovery 5.05
- 轻量级文件服务器Fdfs搭建(fastDFS+n
- FastDFS集群安装所需要的所有文件
- FastDFS分布式存储实战
- FastDFS安装文件
- fastDFS+Nginx安装包(Linux版本)
- Fastdfs+nginx Dockerfile及安装包
- MEGA5.05_Setup.exe
- openwrt-15.05-x86-generic-combined-squashfs.vm
- Nginx安装-让文件服务器fastdfs提供有
- FastDFS_v5.05_安装包、工具包
- ubuntu16.04搭建FASTDFS图片服务器,并配
- FastDHT安装程序
- 5_2 美多商场.zip
- springboot整合fastdfs完整版代码
- SpringMVC+Redis+Activiti+Fastdfs+Thirft+Websoc
- FastDHT相关安装包
- openwrt——15.05
- fastdfs-master.zip
- FastDFS单机版图片服务器
- FastDFS介绍官方文档
- FastDFS API接口文档
- FastDFS与 spring 整合使用 Nginx 来显示图
- 第四套:FastDFS 分布式文件系统集群与
- U6系列T6v3.35.05.1破解100用户
- FastDFS配置文件详解
- fastdfs_client.zip
- FastDFS的Go客户端fdfs_client.zip
- fastdfs-nginx-module-master
评论
共有 条评论