资源简介
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 脚本工具
相关资源
- 主板bios刷新工具 AFUWIN-v5.05.04
- FastDFS一键安装脚本CentOS6.9
- fastDFS断点续传
- UleadGIFAnimator5.05中文免安装去广告绿色
- fdfs_client-windows-py1.2.9.zip
- FastDFS_Client_Win
- fastdfs+nginx 分布式存储图片,支持动态
- FastDFS需要的全部安装包
- FastDFS集群安装包
- fastDFS安装包合集
- FastDFS分部式文件系统linux服务端安装
- FastDFS_v5.05.tar.gz
- FastDFS一键安装脚本centOS6.7
- tools.tar.gz
- Linux Centos7.5 安装FastDFS所需软件
- ngx_devel_kit-0.2.19.tar.gz
评论
共有 条评论