在Redis2.8中有networking.c,这个文件没有networking.h
networking.c首先引入redis.h这个头文件
#include "redis.h"
在redis.c一开始就声明了全局变量
/* Global vars */
struct redisServer server;
networking.c的createClient函数
redisClient *createClient(int fd) {
redisClient *c = zmalloc(sizeof(redisClient));
/* passing -1 as fd it is possible to create a non connected client.
* This is useful since all the Redis commands needs to be executed
* in the context of a client. When commands are executed in other
* contexts (for instance a Lua script) we need a non connected client. */
if (fd != -1) {
anetNonBlock(NULL,fd);
anetEnableTcpNoDelay(NULL,fd);
if (server.tcpkeepalive)
anetK